Commit Graph

1264 Commits

Author SHA1 Message Date
Guillaume Gomez
ad218f9bb9
Rollup merge of #78144 - bugadani:elements-nodrop, r=oli-obk
Don't update `entries` in `TypedArena` if T does not need drop

As far as I can tell, `entries` is only used when dropping `TypedArenaChunk`s and their contents. It is already ignored there, if T is not `mem::needs_drop`, this PR just skips updating it's value.

You can see `TypedArenaChunk` ignoring the entry count in L71. The reasoning is similar to what you can find in `DroplessArena`.

r? @oli-obk
2020-10-20 21:46:40 +02:00
Guillaume Gomez
01e6019448
Rollup merge of #78076 - est31:orphan_mod, r=Mark-Simulacrum
Move orphan module-name/mod.rs files into module-name.rs files
2020-10-20 21:46:35 +02:00
Guillaume Gomez
3fea201b11
Rollup merge of #78061 - wesleywiser:opt_zst_const_interning, r=oli-obk
Optimize const value interning for ZST types

Interning can skip any inhabited ZST type in general.

Fixes #68010

r? @oli-obk
2020-10-20 21:46:32 +02:00
Dániel Buga
2705caed8a Track element count only for types that need drop 2020-10-20 17:01:51 +02:00
Tomasz Miąsko
c2af254e3b Disable MatchBranchSimplification
This optimization can result in unsoundness, because it introduces
additional uses of a place holding the discriminant value without
ensuring that it is valid to do so.
2020-10-20 00:00:00 +00:00
bors
9832374f6e Auto merge of #76893 - lcnr:existential-proj, r=estebank
Improve `skip_binder` usage during FlagComputation

It looks like there was previously a bug around `ExistentialPredicate::Projection` here, don't know how to best trigger that one to add a regression test though.
2020-10-20 08:59:12 +00:00
bors
554633534c Auto merge of #76696 - Aaron1011:tokenstream-avoid-clone, r=petrochenkov
Avoid cloning the contents of a `TokenStream` in a few places
2020-10-20 05:45:08 +00:00
Yuki Okushi
21df410a62
Rollup merge of #78121 - LeSeulArtichaut:issue-78115, r=tmandry
Do not ICE on pattern that uses a binding multiple times in generator

Fixes #78115.
r? @tmandry
2020-10-20 12:11:13 +09:00
Yuki Okushi
3f1c637db4
Rollup merge of #78111 - SNCPlay42:not-always-self, r=lcnr
Trait predicate ambiguities are not always in `Self`

When reporting ambiguities in trait predicates, the compiler incorrectly assumed the ambiguity was always in the type the trait should be implemented on, and never the generic parameters of the trait. This caused silly suggestions for predicates like `<KnownType as Trait<_>>`, such as giving explicit types to completely unrelated variables that happened to be of type `KnownType`.

This also reverts #73027, which worked around this issue in some cases and does not appear to be necessary any more.

fixes #77982
fixes #78055
2020-10-20 12:11:11 +09:00
Yuki Okushi
378ca5e640
Rollup merge of #77931 - aticu:fix_60336, r=petrochenkov
Fix false positive for `unused_parens` lint

Fixes #60336
2020-10-20 12:11:06 +09:00
LeSeulArtichaut
66ac5a2d63 Do not ICE on pattern that uses a binding multiple times in generator 2020-10-19 23:34:47 +02:00
SNCPlay42
c146e8c54f revert workaround #73027 2020-10-19 21:11:40 +01:00
SNCPlay42
71ca239f80 don't assume trait ambiguity happens in Self 2020-10-19 21:11:40 +01:00
bors
a85e949276 Auto merge of #78106 - GuillaumeGomez:rollup-06vwk7p, r=GuillaumeGomez
Rollup of 4 pull requests

Successful merges:

 - #77877 (Use `try{}` in `try_fold` to decouple iterators in the library from `Try` details)
 - #78089 (Fix issue with specifying generic arguments for primitive types)
 - #78099 (Add missing punctuation)
 - #78103 (Add link to rustdoc book in rustdoc help popup)

Failed merges:

r? `@ghost`
2020-10-19 17:53:17 +00:00
Aaron Hill
f6aec82d4d
Avoid cloning the contents of a TokenStream in a few places 2020-10-19 12:30:41 -04:00
Guillaume Gomez
684fbd50ab
Rollup merge of #78089 - varkor:opt_const_param_of-error, r=lcnr
Fix issue with specifying generic arguments for primitive types

Fixes https://github.com/rust-lang/rust/issues/78005.

r? @lcnr
2020-10-19 18:20:23 +02:00
bors
f90e617305 Auto merge of #77908 - bugadani:obl-forest, r=nnethercote
Try to make ObligationForest more efficient

This PR tries to decrease the number of allocations in ObligationForest, as well as moves some cold path code to an uninlined function.
2020-10-19 15:14:15 +00:00
bors
78307d8700 Auto merge of #77278 - camelid:use-correct-article, r=estebank
Use correct article in help message for conversion or cast

Before it always used `an`; now it uses the correct article for the type.
2020-10-19 02:19:21 +00:00
Camelid
3eab21e22d Don't ICE if called with a TyKind::Error
It felt too harsh to estebank and others to ICE even though it's
technically a mistake to show a `TyKind::Error`.
2020-10-18 17:38:47 -07:00
varkor
c0d29fe7d7 Fix issue with specifying generic arguments for primitive types 2020-10-18 22:40:50 +01:00
bors
b1496c6e60 Auto merge of #78075 - est31:remove_redundant_static, r=jonas-schievink
Remove redundant 'static
2020-10-18 21:02:05 +00:00
est31
66c1fc4c87 Move orphan module-name/mod.rs files into module-name.rs files 2020-10-18 20:56:15 +02:00
bors
4d247ad7d3 Auto merge of #77306 - lcnr:inline-ok, r=eddyb
normalize substs while inlining

fixes #68347 or more precisely, this fixes the same ICE in rust analyser as veloren is pinned to a specific nightly
and had an error with the current one.

I didn't look into creating an MVCE here as that seems fairly annoying, will spend a few minutes doing so rn. (failed)

r? `@eddyb` cc `@bjorn3`
2020-10-18 16:10:00 +00:00
est31
b87e4f36e7 Remove redundant 'static in the compiler 2020-10-18 17:30:15 +02:00
bors
834821e3b6 Auto merge of #78066 - bugadani:wat, r=jonas-schievink
Clean up small, surprising bits of code

This PR clean up a small number of unrelated, small things I found while browsing the code base.
2020-10-18 13:50:31 +00:00
bors
98e16884b1 Auto merge of #78058 - bugadani:arena2, r=lcnr
Make sure arenas don't allocate bigger than HUGE_PAGE

Right now, arenas allocate based on the size of the last chunk. It is possible for a `grow` call to allocate a chunk that is not a multiple of `PAGE`, and this size is doubled for each subsequent allocation. This means, instead of `HUGE_PAGE`, the biggest page possible is actually unknown.

This change fixes this, and also removes an unnecessary checked multiplication. It is still possible to allocate bigger than `HUGE_PAGE` pages, but this will only happen as many times as absolutely necessary.
2020-10-18 11:19:14 +00:00
bors
ad268bd638 Auto merge of #78035 - camelid:basic-block-pointer-note, r=RalfJung
Note that `BasicBlock` is just an index

r? `@RalfJung`
2020-10-18 09:08:00 +00:00
Dániel Buga
2e99439900 Replace unnecessary map_or_else with map_or 2020-10-18 11:01:09 +02:00
Dániel Buga
f3a0f68453 Zip -> Enumerate 2020-10-18 11:01:08 +02:00
Dániel Buga
d708d7fb79 No need to map the max_distance 2020-10-18 11:01:08 +02:00
Dániel Buga
ed7c6819e4 Early return to decrease indentation 2020-10-18 11:01:08 +02:00
Dániel Buga
8e548bf8d6 Remove weird slice conversion 2020-10-18 10:31:58 +02:00
Dániel Buga
6f43af26e9 Clean up surprising borrow 2020-10-18 10:31:57 +02:00
bors
94332bbe10 Auto merge of #78047 - khyperia:set_span_mut, r=bjorn3
Make set_span take mut self

This was a mistake in https://github.com/rust-lang/rust/pull/77614

It's not a _huge_ deal, because backends can always implement this with interior mutability, but it's nice to avoid interior mutability when possible. For context, the `set_source_location` method, called alongside `set_span`, also takes `&mut self`.

r? `@eddyb`
2020-10-18 05:36:23 +00:00
Dániel Buga
396561bdb7 Make sure arenas don't allocate bigger than HUGE_PAGE 2020-10-17 23:33:53 +02:00
Camelid
91ba04d872 Note that BasicBlock is just an index 2020-10-17 13:20:42 -07:00
Wesley Wiser
1d07d696d2 Optimize const value interning for ZST types
Interning can skip any inhabited ZST type in general.
2020-10-17 16:07:00 -04:00
bors
043eca7f0b Auto merge of #78060 - JohnTitor:rollup-uou8vyu, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #75802 (resolve: Do not put nonexistent crate `meta` into prelude)
 - #76607 (Modify executable checking to be more universal)
 - #77851 (BTreeMap: refactor Entry out of map.rs into its own file)
 - #78043 (Fix grammar in note for orphan-rule error [E0210])
 - #78048 (Suggest correct place to add `self` parameter when inside closure)
 - #78050 (Small CSS cleanup)
 - #78059 (Set `MDBOOK_OUTPUT__HTML__INPUT_404` on linkchecker)

Failed merges:

r? `@ghost`
2020-10-17 19:39:26 +00:00
Yuki Okushi
57e38dd4fb
Rollup merge of #78048 - blyxxyz:e0424-improve-self-placement, r=lcnr
Suggest correct place to add `self` parameter when inside closure

It would incorrectly suggest adding it as a parameter to the closure instead of the containing function.

[For example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=1936bcd1e5f981573386e0cee985c3c0):
```
help: add a `self` receiver parameter to make the associated `fn` a method
  |
5 |         let _ = || self&self;
  |                        ^^^^^
```

`DiagnosticMetadata.current_function` is only used for these messages so tweaking its behavior should be ok.
2020-10-18 04:11:11 +09:00
Yuki Okushi
407bba4676
Rollup merge of #78043 - willcrozi:e0210-error-note-fix, r=lcnr
Fix grammar in note for orphan-rule error [E0210]

Fixes the grammar in the error note for [E0210] from:

_"= note: implementing a foreign trait is only possible if at least one of the types for which **is it** implemented is local"_

to:

_"= note: implementing a foreign trait is only possible if at least one of the types for which **it is** implemented is local"_

The content of this commit is the result of running the following command at the repository root:

`find . \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i 's/which is it implemented/which it is implemented/g'`
2020-10-18 04:11:09 +09:00
Yuki Okushi
d10b98d7a5
Rollup merge of #75802 - petrochenkov:nometa, r=nikomatsakis
resolve: Do not put nonexistent crate `meta` into prelude

Before the 2018 edition release there was some vague suggestion about adding a crate named `meta` to the standard distribution.
On this basis the name `meta` was "partially reserved" by putting `meta` into extern prelude (this means importing something named `meta` will result in an ambiguity error, for example).
This only caused confusion so far, and two years later there are no specific plans to add such crate.

If some standard crate (named `meta` or not) is added in the future, then cargo will hopefully already have ability to put it into extern prelude explicitly through `Cargo.toml`.
Otherwise, it could be added to extern prelude by the compiler at edition boundary.

Closes https://github.com/rust-lang/rust/issues/73948
2020-10-18 04:11:03 +09:00
bors
ffeeb20398 Auto merge of #77373 - jonas-schievink:rm-rf-copy-prop, r=oli-obk
Remove the old copy propagation pass

This pass was added a long time ago, and has not really seen much improvement since (apart from some great work in https://github.com/rust-lang/rust/pull/76569 that unfortunately ran into preexisting soundness issues). It is slow and unsound, and we now have a destination propagation pass that performs a related optimization and could be extended.

Closes https://github.com/rust-lang/rust/issues/36673
Closes https://github.com/rust-lang/rust/issues/73717
Closes https://github.com/rust-lang/rust/issues/76740
2020-10-17 16:57:21 +00:00
bors
6af9846fcc Auto merge of #77124 - spastorino:const-exprs-rfc-2920, r=oli-obk
Implement const expressions and patterns (RFC 2920)

cc `@ecstatic-morse` `@lcnr` `@oli-obk` `@petrochenkov`
2020-10-17 14:44:51 +00:00
bors
dda2b5e3e2 Auto merge of #78039 - tmiasko:unreachable-block, r=Mark-Simulacrum
Remove unused cached_unreachable_block from MIR builder
2020-10-17 12:36:32 +00:00
Jan Verbeek
e701ae376a Suggest correct place to add self parameter when inside closure
It would incorrectly suggest adding it as a parameter to the closure instead of the
containing function.
2020-10-17 13:36:59 +02:00
khyperia
3d484481c7 Make set_span take mut self 2020-10-17 13:28:58 +02:00
Vadim Petrochenkov
3522add318 resolve: Do not put nonexistent crate meta into prelude 2020-10-17 14:04:49 +03:00
bors
6f0ea299cf Auto merge of #77685 - jackh726:binder-map, r=lcnr
Use rebind instead of Binder::bind when possible

These are really only the easy places. I just searched for `Binder::bind` and replaced where it straightforward.

r? `@lcnr`
cc. `@nikomatsakis`
2020-10-17 10:28:52 +00:00
Will Crozier
786e3ea31a Fix grammar in note for orphan-rule error [E0210] 2020-10-17 11:03:45 +01:00
Dylan DPC
55f9676c47
Rollup merge of #77961 - glandium:embed-bitcode, r=nagisa
Set .llvmbc and .llvmcmd sections as allocatable

This marks both sections as allocatable rather than excluded, which matches what
clang does with the equivalent `-fembed-bitcode` flag.
2020-10-17 03:27:20 +02:00