bors [Mon, 10 Aug 2020 05:34:53 +0000 (05:34 +0000)]
Auto merge of #75204 - cuviper:freebsd11, r=Mark-Simulacrum
Upgrade the FreeBSD toolchain to version 11.4
FreeBSD 10 reached its end-of-life in October 2018, and that toolchain
caused issues in the LLVM 11 upgrade (#73526) that are resolved with the
toolchain from FreeBSD 11.
bors [Mon, 10 Aug 2020 00:09:45 +0000 (00:09 +0000)]
Auto merge of #75351 - JohnTitor:rollup-q9udsyx, r=JohnTitor
Rollup of 8 pull requests
Successful merges:
- #74200 (Std panicking unsafe block in unsafe fn)
- #75286 (Add additional case for Path starts with)
- #75318 (Resolve `char` as a primitive even if there is a module in scope)
- #75320 (Detect likely `for foo of bar` JS syntax)
- #75328 (Cleanup E0749)
- #75344 (Rename "Important traits" to "Notable traits")
- #75348 (Move to intra-doc links in library/core/src/time.rs)
- #75350 (Do not ICE when lowering invalid extern fn with bodies)
bors [Sun, 9 Aug 2020 22:08:02 +0000 (22:08 +0000)]
Auto merge of #75345 - Aaron1011:fix/no-std-hygiene, r=petrochenkov
Remove normalization of `Span` debug output in proc-macro tests
Fixes #74800
The definition of `is_x86_feature_detected!` (and similar macros)
depends on the platform - it is produced by a `cfg_if!` invocation on
x86, and a plain `#[cfg]` on other platforms. Since it is part of the
prelude, we will end up importing different hygiene information
depending on the platform. This previously required us to avoid printing raw
`SyntaxContext` ids in any tests that uses the standard library, since
the captured output will be platform-dependent.
Previously, we replaced all `SyntaxContext` ids with "#CTXT", and the
raw `Span` lo/hi bytes with "LO..HI".
This commit adds `#![no_std]` and `extern crate std` to all proc-macro
tests that print spans. This suppresses the prelude import, while
still using lang items from `std` (which gives us a buildable binary).
With this apporach, we will only load hygiene information for things
which we explicitly import. This lets us re-add
`-Z unpretty=expanded,hygiene`, since its output can now be made stable
across all platforms.
Additionally, we use `-Z span-debug` in more places, which lets us avoid
the "LO..HI" normalization hack.
bors [Sun, 9 Aug 2020 20:08:50 +0000 (20:08 +0000)]
Auto merge of #75278 - cuviper:indexmap, r=Mark-Simulacrum
Upgrade indexmap and use it more
First this upgrades `indexmap` to 1.5.1, which is now based on `hashbrown::raw::RawTable`. This means it shares a lot of the same performance characteristics for insert, lookup, etc., while keeping items in insertion order.
Then across various rustc crates, this replaces a lot of `Vec`+`HashMap` pairs with a single `IndexMap` or `IndexSet`.
Aaron Hill [Sun, 9 Aug 2020 17:36:31 +0000 (13:36 -0400)]
Remove normalization of `Span` debug output in proc-macro tests
Fixes #74800
The definition of `is_x86_feature_detected!` (and similar macros)
depends on the platform - it is produced by a `cfg_if!` invocation on
x86, and a plain `#[cfg]` on other platforms. Since it is part of the
prelude, we will end up importing different hygiene information
depending on the platform. This previously required us to avoid printing raw
`SyntaxContext` ids in any tests that uses the standard library, since
the captured output will be platform-dependent.
Previously, we replaced all `SyntaxContext` ids with "#CTXT", and the
raw `Span` lo/hi bytes with "LO..HI".
This commit adds `#![no_std]` and `extern crate std` to all proc-macro
tests that print spans. This suppresses the prelude import, while
still using lang items from `std` (which gives us a buildable binary).
With this apporach, we will only load hygiene information for things
which we explicitly import. This lets us re-add
`-Z unpretty=expanded,hygiene`, since its output can now be made stable
across all platforms.
Additionally, we use `-Z span-debug` in more places, which lets us avoid
the "LO..HI" normalization hack.
bors [Sun, 9 Aug 2020 18:19:34 +0000 (18:19 +0000)]
Auto merge of #75137 - Aaron1011:fix/hygiene-skip-expndata, r=petrochenkov
Don't serialize ExpnData for foreign crates
When we encode an ExpnId into the crate metadata, we write out the
CrateNum of the crate that 'owns' the corresponding `ExpnData`, which
is later used to decode the `ExpnData` from its owning crate.
However, we current serialize the `ExpnData` for all `ExpnIds` that we
serialize, even if the `ExpnData` was already serialized into a foreign
crate. This commit skips encoding this kind of `ExpnData`, which should
hopefully speed up metadata encoding and reduce the total metadata size.
Josh Stone [Wed, 5 Aug 2020 22:58:35 +0000 (15:58 -0700)]
Upgrade the FreeBSD toolchain to version 11.4
FreeBSD 10 reached its end-of-life in October 2018, and that toolchain
caused issues in the LLVM 11 upgrade (#73526) that are resolved with the
toolchain from FreeBSD 11.
bors [Sun, 9 Aug 2020 03:07:00 +0000 (03:07 +0000)]
Auto merge of #75280 - overdrivenpotato:psp-unwind, r=dtolnay
Add back unwinding support for Sony PSP
This PR adds back unwinding support for the Sony PSP. The `mipsel-sony-psp` target works well with unwinding. In [rust-psp], we use the `panic_unwind` crate along with LLVM's libunwind to catch panics, run destructors, and print them to the debug screen without aborting all threads.
bors [Sun, 9 Aug 2020 01:05:56 +0000 (01:05 +0000)]
Auto merge of #75306 - Amanieu:hashbrown8, r=Mark-Simulacrum
Update hashbrown to 0.8.2
Includes:
- Avoid closures to improve compile times (https://github.com/rust-lang/hashbrown/pull/183)
- Do not iterate to drop if empty (https://github.com/rust-lang/hashbrown/pull/182)
bors [Sat, 8 Aug 2020 23:05:49 +0000 (23:05 +0000)]
Auto merge of #75308 - JohnTitor:rollup-vnnny43, r=JohnTitor
Rollup of 15 pull requests
Successful merges:
- #74712 (Update E0271 explanation)
- #74842 (adjust remaining targets)
- #75151 (Consistent variable name alloc for raw_vec)
- #75162 (Fix the documentation for move about Fn traits implementations)
- #75248 (Add `as_mut_ptr` to `NonNull<[T]>`)
- #75262 (Show multi extension example for Path in doctests)
- #75266 (Add safety section to `NonNull::as_*` method docs)
- #75284 (Show relative example for Path ancestors)
- #75285 (Separate example for Path strip_prefix)
- #75287 (Show Path extension example change multi extension)
- #75288 (Use assert! for Path exists example to check bool)
- #75289 (Remove ambiguity from PathBuf pop example)
- #75290 (fix `min_const_generics` version)
- #75291 (Clean up E0750)
- #75292 (Clean up E0502)
Yuki Okushi [Sat, 8 Aug 2020 21:41:22 +0000 (06:41 +0900)]
Rollup merge of #75248 - TimDiekmann:NonNull-as_mut_ptr, r=RalfJung
Add `as_mut_ptr` to `NonNull<[T]>`
Adds `as_mut_ptr` to shortcut converting a `NonNull<[T]>` to `*mut T` as proposed in https://github.com/rust-lang/rust/issues/74265#issuecomment-669702969.
Yuki Okushi [Sat, 8 Aug 2020 21:41:20 +0000 (06:41 +0900)]
Rollup merge of #75162 - poliorcetics:move-documentation-fix, r=jyn514
Fix the documentation for move about Fn traits implementations
Fixes #74997.
This uses the note from the [reference](https://doc.rust-lang.org/reference/types/closure.html#call-traits-and-coercions) but I can also just put a link to it or do both.
bors [Sat, 8 Aug 2020 20:43:21 +0000 (20:43 +0000)]
Auto merge of #75271 - cuviper:array-iter, r=LukasKalbertodt
Simplify array::IntoIter
- Initialization can use `transmute_copy` to do the bitwise copy.
- `as_slice` can use `get_unchecked` and `MaybeUninit::slice_get_ref`,
and `as_mut_slice` can do similar.
- `next` and `next_back` can use the corresponding `Range` methods.
- `Clone` doesn't need any unsafety, and we can dynamically update the
new range to get partial drops if `T::clone` panics.
bors [Sat, 8 Aug 2020 18:15:50 +0000 (18:15 +0000)]
Auto merge of #75163 - canova:map_into_keys_values, r=dtolnay
Implement `into_keys` and `into_values` for associative maps
This PR implements `into_keys` and `into_values` for HashMap and BTreeMap types. They are implemented as unstable, under `map_into_keys_values` feature.
Fixes #55214.
r? @dtolnay
bors [Sat, 8 Aug 2020 15:57:12 +0000 (15:57 +0000)]
Auto merge of #75260 - davidtwco:polymorphization-promoted-substs, r=lcnr
polymorphize: unevaluated constants
This PR makes polymorphization visit the promoted MIR of unevaluated constants with available promoted MIR instead of visiting the substitutions of that constant - which will mark all of the generic parameters as used; in addition polymorphization will now visit non-promoted unevaluated constants rather than visit their substs.
bors [Sat, 8 Aug 2020 13:33:53 +0000 (13:33 +0000)]
Auto merge of #74533 - nikic:issue-74425, r=eddyb
Emit == null instead of <= null for niche check
When the niche maximum is zero, emit a "== zero" check instead of a "<= zero" check. In particular, this avoids the awkward case of "<= null". While LLVM does canonicalize this to "== null", this apparently doesn't happen for constant expressions, leading to the issue in #74425. While that can be addressed on the LLVM side, it still seems prudent to emit sensible IR here, because this will allow null checks to be optimized earlier in the pipeline.
bors [Sat, 8 Aug 2020 09:46:16 +0000 (09:46 +0000)]
Auto merge of #75282 - RalfJung:miri-black-box, r=oli-obk
do not call black_box on Miri
Helps with https://github.com/rust-lang/rust/issues/75274 (but https://github.com/rust-lang/rust/pull/74932 introduced unrelated breakage that will need a separate fix)
Cc @eggyal r? @Mark-Simulacrum
When the niche maximum is zero, emit a "== zero" check instead of
a "<= zero" check. In particular, this avoid the awkward case of
"<= null". While LLVM does canonicalize this to "!= null", this
appently doesn't happen for constant expressions, leading to the
issue in #74425. While that can be addressed on the LLVM side, it
still seems prudent to emit sensible IR here, because this will
allow null checks to be optimized earlier in the pipeline.
bors [Sat, 8 Aug 2020 03:54:33 +0000 (03:54 +0000)]
Auto merge of #75276 - JohnTitor:rollup-rz4hs0w, r=JohnTitor
Rollup of 7 pull requests
Successful merges:
- #75224 (Don't call a function in function-arguments-naked.rs)
- #75237 (Display elided lifetime for non-reference type in doc)
- #75250 (make MaybeUninit::as_(mut_)ptr const)
- #75253 (clean up const-hacks in int endianess conversion functions)
- #75259 (Add missing backtick)
- #75267 (Small cleanup)
- #75270 (fix a couple of clippy findings)
Yuki Okushi [Sat, 8 Aug 2020 02:36:03 +0000 (11:36 +0900)]
Rollup merge of #75237 - nbdd0121:rustdoc, r=jyn514
Display elided lifetime for non-reference type in doc
In edition 2018 we encourage writing `<'_>` explicitly, so rustdoc should display like such as well.
Fixes #75225
~~Somehow when I run the compiled rustdoc using `cargo +stage2 doc` on other crates, it correctly produces `<'_>`, but I couldn't get the std doc to do the same with `./x.py doc --stage 2`. Might this be related to the recent change to x.py about how the doc is built?~~
Yuki Okushi [Sat, 8 Aug 2020 02:36:02 +0000 (11:36 +0900)]
Rollup merge of #75224 - Aaron1011:fix/function-arguments-naked, r=Amanieu
Don't call a function in function-arguments-naked.rs
Fixes #75096
It's U.B. to use anything other than inline assmebling in a naked
function. Fortunately, the `#break` directive works fine without
anything in the function body.
Eliminate the `SessionGlobals` from `librustc_ast`.
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This
means they are accessed via the `Session`, rather than via TLS. A few
`Attr` methods and `librustc_ast` functions are now methods of
`Session`.
All of this required passing a `Session` to lots of functions that didn't
already have one. Some of these functions also had arguments removed, because
those arguments could be accessed directly via the `Session` argument.
`contains_feature_attr()` was dead, and is removed.
Some functions were moved from `librustc_ast` elsewhere because they now need
to access `Session`, which isn't available in that crate.
- `entry_point_type()` --> `librustc_builtin_macros`
- `global_allocator_spans()` --> `librustc_metadata`
- `is_proc_macro_attr()` --> `Session`