Commit Graph

136521 Commits

Author SHA1 Message Date
Ashley Mannix
d65cb6ebce deprecate atomic::spin_loop_hint in favour of hint::spin_loop 2021-01-13 16:30:29 +10:00
Camelid
e8c87935e0 Include .. suggestion if fields are all wildcards 2021-01-12 21:20:26 -08:00
Eric Huss
6bfd987aa0 Update books 2021-01-12 21:20:21 -08:00
Ashley Mannix
7e83fece91 remove unstable deprecated Vec::remove_item 2021-01-13 15:14:11 +10:00
Camelid
c200036274 Put all feature gate tests under feature-gates/
There was one directory that had only a single test and there was also a
test in the top-level directory. This moves both of them to
`feature-gates/`.
2021-01-12 20:57:57 -08:00
Camelid
c3f7429fb4 Use better ICE message when no MIR is available
The ICE message is somewhat confusing and overly specific - the issue is
that there's no MIR available.

This should make debugging these ICEs easier since the error tells you
what's actually wrong, not what it was trying to do when it failed.

cc https://github.com/rust-lang/rust/pull/80952#issuecomment-759198841
2021-01-12 20:54:35 -08:00
Ashley Mannix
b2f504801c stabilize the poll_map feature 2021-01-13 14:51:27 +10:00
bors
fc93e4719c Auto merge of #80960 - Dylan-DPC:rollup-89tri8x, r=Dylan-DPC
Rollup of 10 pull requests

Successful merges:

 - #78901 (diagnostics: Note capturing closures can't be coerced to fns)
 - #79588 (Provide more information for HRTB lifetime errors involving closures)
 - #80232 (Remove redundant def_id lookups)
 - #80662 (Added support for i386-unknown-linux-gnu and i486-unknown-linux-gnu)
 - #80736 (use Once instead of Mutex to manage capture resolution)
 - #80796 (Update to LLVM 11.0.1)
 - #80859 (Fix --pretty=expanded with --remap-path-prefix)
 - #80922 (Revert "Auto merge of #76896 - spastorino:codegen-inline-fns2)
 - #80924 (Fix rustdoc --test-builder argument parsing)
 - #80935 (Rename `rustc_middle::lint::LevelSource` to `LevelAndSource`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-13 04:29:45 +00:00
Ashley Mannix
5584224fda
bump split_inclusive stabilization to 1.51.0 2021-01-13 13:51:37 +10:00
Ashley Mannix
e4a2f33360
bump split_inclusive stabilization to 1.51.0 2021-01-13 13:50:39 +10:00
Ashley Mannix
0620514094
bump split_inclusive stabilization to 1.51.0 2021-01-13 13:49:34 +10:00
Ashley Mannix
bd2c072b9b
bump split_inclusive stabilization to 1.51.0 2021-01-13 13:48:36 +10:00
Eric Huss
2451833174 Update cargo 2021-01-12 19:46:42 -08:00
Camelid
d7307a71f5 Always show suggestions in their own subwindows 2021-01-12 19:25:51 -08:00
Camelid
1bce775769 Add a test case with lots of whitespace 2021-01-12 19:25:51 -08:00
Camelid
9959d6deed Only suggest .. if more than one field is missing 2021-01-12 19:25:51 -08:00
Camelid
fe82cc38a0 Specialize .. help message for all fields vs. the rest 2021-01-12 19:25:50 -08:00
Camelid
a5e8e6ec2d Pluralize 'parenthesis' correctly
It's 'parentheses', not 'parenthesis', when you have more than one.
2021-01-12 19:25:50 -08:00
Camelid
f3d9df54ee Suggest Variant(..) if all of the mentioned fields are _ 2021-01-12 19:25:50 -08:00
Camelid
5fe61a79cc Simplify code
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2021-01-12 19:25:50 -08:00
Camelid
16692ab66a Suggest _ and .. if a pattern has too few fields
For example, this code:

    struct S(i32, f32);

    let S(x) = S(0, 1.0);

will make the compiler suggest either:

    let S(x, _) = S(0, 1.0);

or:

    let S(x, ..) = S(0, 1.0);
2021-01-12 19:25:49 -08:00
Dylan DPC
5b90fe1c30
Rollup merge of #80935 - pierwill:rustc_middle-levelandsource, r=petrochenkov
Rename `rustc_middle::lint::LevelSource` to `LevelAndSource`

This continues work in https://github.com/rust-lang/rust/pull/80274 to improve code readability.

This naming follows a pattern seen elsewhere in the compiler (e.g. [`rustc_middle::ty::TypeAndMut`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TypeAndMut.html)).
2021-01-13 03:20:27 +01:00
Dylan DPC
c64d3f0afc
Rollup merge of #80924 - teryror:issue-80893-fix, r=jyn514
Fix rustdoc --test-builder argument parsing

My suggested fix to issue #80893. I can actually hook Miri in there now.

I also fixed what I believe to be a typo in the option's help text.
2021-01-13 03:20:25 +01:00
Dylan DPC
d64e703e4f
Rollup merge of #80922 - spastorino:revert-inline-always-in-debug, r=wesleywiser
Revert "Auto merge of #76896 - spastorino:codegen-inline-fns2

This reverts commit ddf2cc7f8e, reversing
changes made to 937f629535.

As `@alexcrichton` pointed out in https://github.com/rust-lang/rust/issues/80916 there's a problem with the taken approach.
2021-01-13 03:20:23 +01:00
Dylan DPC
7ce8246a23
Rollup merge of #80859 - jsgf:fix-pretty-remap, r=davidtwco
Fix --pretty=expanded with --remap-path-prefix

Per https://github.com/rust-lang/rust/issues/80832, using
--pretty=expanded and --remap-path-prefix results in an ICE.

This is becasue the session source files table is stored in remapped
form, whereas --pretty-expanded looks up unremapped files. This remaps
the path prefixes before lookup.

~~There don't appear to be any existing tests for --pretty=expanded; I'll look into
adding some.~~ Never mind, found the pretty tests.

Fixes #80832
2021-01-13 03:20:21 +01:00
Dylan DPC
330e196c49
Rollup merge of #80796 - cuviper:llvm-11.0.1, r=nikic
Update to LLVM 11.0.1

This updates to a new LLVM branch, rebased on the upstream `llvmorg-11.0.1`. All our patches applied cleanly except the fortanix unwind changes, which just needed a small adjustment in cmake files.

r? `@nikic`
Fixes https://github.com/rust-lang/rust/issues/73722
2021-01-13 03:20:19 +01:00
Dylan DPC
e73ee1dde2
Rollup merge of #80736 - KodrAus:feat/lazy-resolve, r=dtolnay
use Once instead of Mutex to manage capture resolution

For #78299

This allows us to return borrows of the captured backtrace frames that are tied to a borrow of the Backtrace itself, instead of to some short-lived Mutex guard.

We could alternatively share `&Mutex<Capture>`s and lock on-demand, but then we could potentially forget to call `resolve()` before working with the capture. It also makes it semantically clearer what synchronization is needed on the capture.

cc `@seanchen1991` `@rust-lang/project-error-handling`
2021-01-13 03:20:17 +01:00
Dylan DPC
492cb39825
Rollup merge of #80662 - rxrbln:master, r=estebank
Added support for i386-unknown-linux-gnu and i486-unknown-linux-gnu

Support for both can be useful when creating new firmware, boot loaders,
or embedded operating systems.
2021-01-13 03:20:15 +01:00
Dylan DPC
ac7267a5e7
Rollup merge of #80232 - bugadani:roundtrip, r=estebank
Remove redundant def_id lookups

Simplify `DefId -> LocalDefId -> HirId -> LocalDefId -> DefId` chains.
2021-01-13 03:20:13 +01:00
Dylan DPC
11bca6b07f
Rollup merge of #79588 - estebank:issue-79187, r=oli-obk
Provide more information for HRTB lifetime errors involving closures
2021-01-13 03:20:11 +01:00
Dylan DPC
45ba015357
Rollup merge of #78901 - arora-aman:fix_closure_coerce, r=estebank
diagnostics: Note capturing closures can't be coerced to fns

Fixes #72457, fixes #71895

r? `@estebank`
2021-01-13 03:20:09 +01:00
bors
150d1fee04 Auto merge of #79322 - jyn514:refactor-impl, r=estebank
Separate out a `hir::Impl` struct

This makes it possible to pass the `Impl` directly to functions, instead
of having to pass each of the many fields one at a time. It also
simplifies matches in many cases.

See `rustc_save_analysis::dump_visitor::process_impl` or `rustdoc::clean::clean_impl` for a good example of how this makes `impl`s easier to work with.

r? `@petrochenkov` maybe?
2021-01-13 01:40:41 +00:00
Joshua Nelson
a8ff647deb Separate out a hir::Impl struct
This makes it possible to pass the `Impl` directly to functions, instead
of having to pass each of the many fields one at a time. It also
simplifies matches in many cases.
2021-01-12 20:32:33 -05:00
Tomasz Miąsko
16857317a6 Skip promoted mir of struct constructors & enum constructors 2021-01-13 00:33:36 +01:00
Tomasz Miąsko
a6dd7b5056 Consistently avoid constructing optimized MIR when not doing codegen
The optimized MIR for closures is being encoded unconditionally, while
being unnecessary for cargo check. This turns out to be especially
costly with MIR inlining enabled, since it triggers computation of
optimized MIR for all callees that are being examined for inlining
purposes.

Skip encoding of optimized MIR for closures, enum constructors, struct
constructors, and trait fns when not doing codegen, like it is already
done for other items since 49433.
2021-01-13 00:33:36 +01:00
bors
058a710165 Auto merge of #79670 - Nadrieril:uninhabited-query, r=estebank
Turn type inhabitedness into a query to fix `exhaustive_patterns` perf

We measured in https://github.com/rust-lang/rust/pull/79394 that enabling the [`exhaustive_patterns` feature](https://github.com/rust-lang/rust/issues/51085) causes significant perf degradation. It was conjectured that the culprit is type inhabitedness checking, and [I hypothesized](https://github.com/rust-lang/rust/pull/79394#issuecomment-733861149) that turning this computation into a query would solve most of the problem.

This PR turns `tcx.is_ty_uninhabited_from` into a query, and I measured a 25% perf gain on the benchmark that stress-tests `exhaustiveness_patterns`. This more than compensates for the 30% perf hit I measured [when creating it](https://github.com/rust-lang/rustc-perf/pull/801). We'll have to measure enabling the feature again, but I suspect this fixes the perf regression entirely.
I'd like a perf run on this PR obviously.
I made small atomic commits to help reviewing. The first one is just me discovering the "revisions" feature of the testing framework.

I believe there's a push to move things out of `rustc_middle` because it's huge. I guess `inhabitedness/mod.rs` could be moved out, but it's quite small. `DefIdForest` might be movable somewhere too. I don't know what the policy is for that.

Ping `@camelid` since you were interested in following along
`@rustbot` modify labels: +A-exhaustiveness-checking
2021-01-12 22:58:42 +00:00
Esteban Küber
a8a974245e Provide more information for HRTB lifetime errors involving closures 2021-01-12 13:53:13 -08:00
Nadrieril
e608d8f4e5 Make DefIdForest cheaper to clone
Since `DefIdForest` contains 0 or 1 elements the large majority of the
time, by allocating only in the >1 case we avoid almost all allocations,
compared to `Arc<SmallVec<[DefId;1]>>`. This shaves off 0.2% on the
benchmark that stresses uninhabitedness checking.
2021-01-12 20:31:58 +00:00
Josh Stone
1f1a3b4857 move WriteCloneIntoRaw into alloc::alloc 2021-01-12 12:24:28 -08:00
Matthew Jasper
b0ac0fbdef Bless profiler run make tests 2021-01-12 20:24:07 +00:00
Tomasz Miąsko
1bf3949398 Reorder MIR encoding checks
Start from least expensive checks when deciding whether to encode MIR or not.

No functional changes intended.
2021-01-12 21:18:39 +01:00
bors
7a9b552cb1 Auto merge of #80009 - jumbatm:issue79581-overeager-clashing-extern-decl, r=alexcrichton
Use tcx.symbol_name when determining clashing extern declarations.

Fixes #79581.

r? `@alexcrichton`
2021-01-12 20:13:50 +00:00
Nadrieril
8598c9f6e5 Turn type inhabitedness into a query 2021-01-12 19:59:11 +00:00
Nadrieril
b82f149d08 Add tests for uninhabited types 2021-01-12 19:59:10 +00:00
Nadrieril
622bfdb2fd Deduplicate some tests using revisions 2021-01-12 19:59:10 +00:00
Tyson Nottingham
8e7cbc28a6 Prevent potential bug resulting from changing crate_hash query name 2021-01-12 11:22:58 -08:00
Tyson Nottingham
0962e5eba9 Return to defining crate_hash similarly to other query providers 2021-01-12 11:22:58 -08:00
Tyson Nottingham
62139ffad4 Remove DepKind::CrateMetadata and pre-allocation of DepNodes
Remove much of the special-case handling around crate metadata
dependency tracking by replacing `DepKind::CrateMetadata` and the
pre-allocation of corresponding `DepNodes` with on-demand invocation
of the `crate_hash` query.
2021-01-12 11:22:57 -08:00
bors
704e47f78b Auto merge of #78407 - oli-obk:ub_checkable_ctfe, r=RalfJung,pnkfelix
Make CTFE able to check for UB...

... by not doing any optimizations on the `const fn` MIR used in CTFE. This means we duplicate all `const fn`'s MIR now, once for CTFE, once for runtime. This PR is for checking the perf effect, so we have some data when talking about https://github.com/rust-lang/const-eval/blob/master/rfcs/0000-const-ub.md

To do this, we now have two queries for obtaining mir: `optimized_mir` and `mir_for_ctfe`. It is now illegal to invoke `optimized_mir` to obtain the MIR of a const/static item's initializer, an array length, an inline const expression or an enum discriminant initializer. For `const fn`, both `optimized_mir` and `mir_for_ctfe` work, the former returning the MIR that LLVM should use if the function is called at runtime. Similarly it is illegal to invoke `mir_for_ctfe` on regular functions.

This is all checked via appropriate assertions and I don't think it is easy to get wrong, as there should be no `mir_for_ctfe` calls outside the const evaluator or metadata encoding. Almost all rustc devs should keep using `optimized_mir` (or `instance_mir` for that matter).
2021-01-12 17:26:56 +00:00
Tristan Dannenberg
f3c8f29b3b
Simplify regression test
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-01-12 18:18:10 +01:00