Rollup merge of #64799 - Aaron1011:fix/double-panic, r=Mark-Simulacrum
Fix double panic when printing query stack during an ICE
On the latest nightly, any call to `bug` or `span_bug` will result in two panics - the first one as a normal result of calling `bug` / `span_bug`, and the second as a result of trying to print the query stack from the panic handler. This is caused by the query-printing code attempting to acquire a lock on `HandlerInnder`, which is still being held by `bug`.
This PR moves the actual panic out of `HandlerInner`, into `Handler`. This allows us to release the lock on `HandlerInner` before triggering the panic, ensuring that the panic handler will be able to acquire the lock if necessary.
Rollup merge of #64589 - andre-richter:aarch64_bare_metal, r=Amanieu
Differentiate AArch64 bare-metal targets between hf and non-hf.
CC @parched, kindly request you to review.
~~Note: This change breaks code that uses the target `aarch64-unknown-none` for the sake of clearer naming as discussed in the links posted below. A search on github reveals that code using `aarch64-unknown-none` is almost exclusively forked from our embedded WG's OS tutorials repo at https://github.com/rust-embedded/rust-raspi3-OS-tutorials, for which the target was originally created.~~
~~I will adapt this repo to the new target name asap once this PR would go upstream. The minor annoyance for the forks to break temporarily should be acceptable for the sake of introducing a better differentiation now before it is too late.
Also, the break would only happen upon updating the toolchain, giving the user a good hint at what has happened.~~
---------- Patch commit message:
Following up on [1] and [2], this PR adds differntiation for aarch64 bare-metal
targets between versions with and without floating point enabled.
This streamlines the target naming with other existing ARM targets and provides
the user clear indication if he is getting float or non-float for his bare-metal
target.
Rollup merge of #63492 - eddyb:cvarargs, r=nagisa,matthewjasper
Remove redundancy from the implementation of C variadics.
This cleanup was first described in https://github.com/rust-lang/rust/issues/44930#issuecomment-497163539:
* AST doesn't track `c_variadic: bool` anymore, relying solely on a trailing `CVarArgs` type in fn signatures
* HIR doesn't have a `CVarArgs` anymore, relying solely on `c_variadic: bool`
* same for `ty::FnSig` (see tests for diagnostics improvements from that)
* `{hir,mir}::Body` have one extra argument than the signature when `c_variadic == true`
* `rustc_typeck` and `rustc_mir::{build,borrowck}` need to give that argument the right type (which no longer uses a lifetime parameter, but a function-internal scope)
* `rustc_target::abi::call` doesn't need special hacks anymore (since it never sees the `VaListImpl` now, it's all inside the body)
Auto merge of #64883 - Centril:rollup-uehjt63, r=Centril
Rollup of 10 pull requests
Successful merges:
- #64131 (data_structures: Add deterministic FxHashMap and FxHashSet wrappers)
- #64387 (Fix redundant semicolon lint interaction with proc macro attributes)
- #64678 (added more context for duplicate lang item errors (fixes #60561))
- #64763 (Add E0734 and its long explanation)
- #64793 (Fix format macro expansions spans to be macro-generated)
- #64837 (Improve wording in documentation of MaybeUninit)
- #64852 (Print ParamTy span when accessing a field (#52082))
- #64875 (Upgrade async/await to "used" keywords.)
- #64876 (Fix typo in intrinsics op safety)
- #64880 (Slice docs: fix typo)
Rollup merge of #64793 - immunant:format_spans, r=matthewjasper
Fix format macro expansions spans to be macro-generated
New Exprs generated as part of the format macro expansion should get the macro
expansion span with an expansion context, rather than the span of the format string
which does not.
Rollup merge of #64678 - tomtau:fix/no-std-error, r=matthewjasper
added more context for duplicate lang item errors (fixes #60561)
Some more information about #60561 -- these errors are pretty common when one works in restrictive environments with `no_std` or customized `std`, but they don't provide much context for debugging, as any transitive dependency could have brought in `std` crate. With that, currently, one needs to use something like `cargo tree` and investigate transitive dependencies one by one.
It'll be more helpful to know at least the crate that uses `std` (which `cargo tree` doesn't show) to pin down this investigation when debugging.
I'm not sure what the best way to get this context is inside rustc internals (I'm new to them). I found that `all_crate_nums` query returns the crates in some dependency order, so printing out the name of the preceding crate seems to do the trick. But I welcome suggestions if this can be done in a better way.
Rollup merge of #64387 - nathanwhit:redundant-semi-fix, r=varkor
Fix redundant semicolon lint interaction with proc macro attributes
Fixes #63967 and fixes #63947, both of which were caused by the lint's changes to the parser interacting poorly with proc macro attributes and causing span information to be lost
Rollup merge of #64131 - shivan1b:deterministic-fxhashmap, r=Mark-Simulacrum
data_structures: Add deterministic FxHashMap and FxHashSet wrappers
StableMap
A wrapper for FxHashMap that allows to `insert`, `remove`, `get`, `get_mut` and convert a hashmap into a sorted vector using the method `into_sorted_vector` but no iteration support.
StableSet
A wrapper for FxHashSet that allows to `insert`, `remove`, `get` and convert a hashset into a sorted vector using the method `into_sorted_vector` but no iteration support.
Auto merge of #64864 - Centril:rollup-pxz6tw3, r=Centril
Rollup of 14 pull requests
Successful merges:
- #64703 (Docs: slice elements are equidistant)
- #64745 (Include message on tests that should panic but do not)
- #64781 (Remove stray references to the old global tcx)
- #64794 (Remove unused DepTrackingMap)
- #64802 (Account for tail expressions when pointing at return type)
- #64809 (hir: Disallow `target_feature` on constants)
- #64815 (Fix div_duration() marked as stable by mistake)
- #64818 (update rtpSpawn's parameters type(It's prototype has been updated in libc))
- #64830 (Thou shallt not `.abort_if_errors()`)
- #64836 (Stabilize map_get_key_value feature)
- #64845 (pin.rs: fix links to primitives in documentation)
- #64847 (Upgrade env_logger to 0.7)
- #64851 (Add mailmap entry for Dustin Bensing by request)
- #64859 (check_match: improve diagnostics for `let A = 2;` with `const A: i32 = 3`)
Rollup merge of #64859 - Centril:const-def-here-new-var, r=estebank
check_match: improve diagnostics for `let A = 2;` with `const A: i32 = 3`
For example:
```
error[E0005]: refutable pattern in local binding: `std::i32::MIN..=1i32` and `3i32..=std::i32::MAX` not covered
--> $DIR/const-pat-non-exaustive-let-new-var.rs:2:9
|
LL | let A = 3;
| ^
| |
| interpreted as a constant pattern, not a new variable
| help: introduce a variable instead: `a_var`
...
LL | const A: i32 = 2;
| ----------------- constant defined here
```
Rollup merge of #64809 - davidtwco:issue-64768-target-feature-const, r=varkor
hir: Disallow `target_feature` on constants
Fixes #64768.
This PR fixes an ICE when `#[target_feature]` is applied to constants by disallowing this with the same error as when `#[target_feature]` is applied to other places it shouldn't be.
I couldn't see anything in the [RFC](https://github.com/rust-lang/rfcs/blob/master/text/2045-target-feature.md) that suggested that `#[target_feature]` should be applicable to constants or any tests that suggested it should, though I might have missed something - if this is desirable in future, it remains possible to remove this error (but for the time being, I think this error is better than an ICE).
I also added some extra cases to the test for other places where `#[target_feature]` should not be permitted.
Rollup merge of #64802 - estebank:walk-parents-iterator, r=matthewjasper
Account for tail expressions when pointing at return type
When there's a type mismatch we make an effort to check if it was
caused by a function's return type. This logic now makes sure to
only point at the return type if the error happens in a tail
expression.
Rollup merge of #64703 - llogiq:slices-elems-are-equidistant, r=rkruppe
Docs: slice elements are equidistant
Recently, someone asked why `[char]` and `str` are not interchangeable, and I explained that in a slice, the elements must be laid out equidistantly, whereas the chars in a `str` are stored compactly regardless their size. However I couldn't find this documented anywhere, so here's a small addition of this fact.
Auto merge of #64790 - Centril:rip-ast-borrowck, r=matthewjasper
Rest In Peace, AST borrowck (2012-2019)
After having served us for 7 years, the AST borrow-checker is no more.
This PR starts from the commit `rm -rf librustc_ast_borrowck`, building on https://github.com/rust-lang/rust/pull/64221, and is probably best read commit by commit.
Migrate mode is not removed yet as it may be useful for NLL => polonius and it is also used for the `mutable_borrow_reservation_conflict` issue (https://github.com/rust-lang/rust/issues/59159).
Mark Rousskov [Wed, 25 Sep 2019 20:40:24 +0000 (16:40 -0400)]
Remove shrink_to_tcx_lifetime
There's no longer two distinct gcx and tcx lifetimes which made this
necessary (or, at least, the code compiles -- it's possible we got
better at normalizing, but that seems unlikely).
Changes:
````
Remove clippy::author attribute from trailing_zeroes test
Move author issue test to author subdir
Fix author lint
Rustup to rust-lang/rust#64813
Refactor `booleans`
Detect assignment ops in integer_arithmetic
````
Changes:
````
Remove clippy::author attribute from trailing_zeroes test
Move author issue test to author subdir
Fix author lint
Rustup to rust-lang/rust#64813
Refactor `booleans`
Detect assignment ops in integer_arithmetic
````
Account for tail expressions when pointing at return type
When there's a type mismatch we make an effort to check if it was
caused by a function's return type. This logic now makes sure to
only point at the return type if the error happens in a tail
expression.
Tomas Tauber [Fri, 27 Sep 2019 13:32:04 +0000 (21:32 +0800)]
getting more context for duplicate lang items (fixes #60561)
Where possible, the error message includes the name of the crate
that brought in the crate with duplicate lang items (which
helps with debugging). This information is passed on from cstore
using the `extern_crate` query.
Auto merge of #64813 - varkor:node-to-kind, r=Centril
Rename `*.node` to `*.kind`, and `hair::Pattern*` to `hair::Pat*`
In both `ast::Expr` and `hir::Expr`:
- Rename `Expr.node` to `Expr.kind`.
- Rename `Pat.node` to `Pat.kind`.
- Rename `ImplItem.node` to `ImplItem.kind`.
- Rename `Lit.node` to `Lit.kind`.
- Rename `TraitItem.node` to `TraitItem.kind`.
- Rename `Ty.node` to `Ty.kind`.
- Rename `Stmt.node` to `Stmt.kind`.
- Rename `Item.node` to `Item.kind`.
- Rename `ForeignItem.node` to `ForeignItem.kind`.
- Rename `MetaItem.node` to `MetaItem.kind`.
Also:
- Rename `hair::FieldPattern` to `hair::FieldPat`.
- Rename `hair::PatternKind` to `hair::PatKind`.
- Rename `hair::PatternRange` to `hair::PatRange`.
- Rename `PatternContext` to `PatCtxt`.
- Rename `PatternTypeProjection` to `PatTyProj`.
- Rename `hair::Pattern` to `hair::Pat`.
These two sets of changes are grouped together to aid with merging. The only changes are renamings.