Tyler Mandry [Fri, 14 Aug 2020 01:00:26 +0000 (18:00 -0700)]
Rollup merge of #75500 - glandium:arm64-mac-zlib, r=Mark-Simulacrum
Disable zlib in LLVM on aarch64-apple-darwin
For some reason, building rustc on the Apple Silicon DTK fails with some undefined symbols from zlib, which I guess is similar to some issues that appeared on *-apple-ios and *-apple-tvos.
Tyler Mandry [Fri, 14 Aug 2020 01:00:25 +0000 (18:00 -0700)]
Rollup merge of #75496 - spastorino:prioritization-zulip-topics, r=Mark-Simulacrum
Prioritization WG: Open Zulip topics only for `I-prioritize` issues
This was discussed in https://rust-lang.zulipchat.com/#narrow/stream/227806-t-compiler.2Fwg-prioritization/topic/nominations.20and.20other.20automatically.20opened.20topics
Is not being helpful to open topics on any of these events and it's even causing more work for the group.
@LeSeulArtichaut ... I think this is all that's needed to get rid of this, right?.
Tyler Mandry [Fri, 14 Aug 2020 01:00:19 +0000 (18:00 -0700)]
Rollup merge of #75471 - richkadel:llvm-program-name, r=wesleywiser
Change registered "program name" for -Cllvm-args usage messages
While debugging a codegen issue, I tried adding LLVM options with
the rustc -Cllvm-args option, and was confused by the error and usage
messaging.
The LLVM "program name" argument is set to "rustc", and command line
error messages make it look like invalid arguments are "rustc"
arguments, not LLVM.
I changed this argument so error messages and the "-help" usage feedback
is easier to understand and react to. (Clang does something similar.)
Tyler Mandry [Fri, 14 Aug 2020 01:00:13 +0000 (18:00 -0700)]
Rollup merge of #75459 - RalfJung:local-info, r=oli-obk
fix LocalInfo doc comment
The doc comment makes it sound like this is diagnostics-only, but that is not true -- even [unsafety checking uses this information](https://github.com/rust-lang/rust/blob/ded20c98be8585b2a9fe4eeadd1be5524f6ffb17/src/librustc_mir/transform/check_unsafety.rs#L206), so it is crucial for soundness, not just "nice to have".
Tyler Mandry [Fri, 14 Aug 2020 01:00:11 +0000 (18:00 -0700)]
Rollup merge of #75452 - michaelwoerister:sp-cache-more-query-keys, r=lcnr
self-profile: Cache more query key strings when doing self-profiling.
This PR adds optimized `SpecIntoSelfProfilingString` implementations for two common query key types (`LocalDefId` and `WithOptConstParam`). This makes raw self-profiling data on disk 8-9% smaller for my two test cases (`regex` and `cargo`).
The on-disk format is not affected, so no tooling updates need to happen.
I also tried adding an impl for `Ty<'tcx>` (which should reduce size quite a bit) but the compiler did not allow me to add a specialized impl parameterized with `'tcx`. I don't know if there is an actual problem with that or if the implementation of specialization just doesn't support it yet.
Tyler Mandry [Fri, 14 Aug 2020 01:00:10 +0000 (18:00 -0700)]
Rollup merge of #75417 - npmccallum:naked, r=matthewjasper
Don't spill operands onto the stack in naked functions
Currently, the code spills operands onto the stack for the purpose of
debuginfo. However, naked functions can only contain an asm block. Therefore,
attempting to spill the operands on the stack is undefined behavior.
Fixes https://github.com/rust-lang/rust/issues/42779
cc https://github.com/rust-lang/rust/issues/32408
Note that this PR reverts https://github.com/rust-lang/rust/pull/74105 which ultimately didn't fix the problem.
bors [Thu, 13 Aug 2020 21:36:02 +0000 (21:36 +0000)]
Auto merge of #75105 - ssomers:btree_respect_min_len_hard, r=Mark-Simulacrum
Hard way to respect BTreeMap's minimum node length
Resolves #74834 the hard way (though not the hardest imaginable).
Benchmarks (which are all biased/realistic, inserting keys in ascending order) say:
```
benchcmp r0 r1 --threshold 10
name r0 ns/iter r1 ns/iter diff ns/iter diff % speedup
btree::map::clone_slim_100_and_clear 2,183 2,723 540 24.74% x 0.80
btree::map::clone_slim_100_and_drain_all 3,652 4,173 521 14.27% x 0.88
btree::map::clone_slim_100_and_drain_half 3,320 3,940 620 18.67% x 0.84
btree::map::clone_slim_100_and_into_iter 2,154 2,717 563 26.14% x 0.79
btree::map::clone_slim_100_and_pop_all 3,372 3,870 498 14.77% x 0.87
btree::map::clone_slim_100_and_remove_all 5,111 5,647 536 10.49% x 0.91
btree::map::clone_slim_100_and_remove_half 3,259 3,821 562 17.24% x 0.85
btree::map::iter_0 1,733 1,509 -224 -12.93% x 1.15
btree::map::iter_100 2,714 3,739 1,025 37.77% x 0.73
btree::map::iter_10k 3,728 4,269 541 14.51% x 0.87
btree::map::range_unbounded_unbounded 28,426 36,631 8,205 28.86% x 0.78
btree::map::range_unbounded_vs_iter 28,808 34,056 5,248 18.22% x 0.85
```
This difference is not caused by the `debug_assert`-related code in the function `splitpoint`, it's the same without.
bors [Thu, 13 Aug 2020 19:26:35 +0000 (19:26 +0000)]
Auto merge of #75382 - JulianKnodt:match_branches, r=oli-obk
First iteration of simplify match branches
This is a simple MIR pass that attempts to convert
```
bb0: {
StorageLive(_2);
_3 = discriminant(_1);
switchInt(move _3) -> [0isize: bb2, otherwise: bb1];
}
bb1: {
_2 = const false;
goto -> bb3;
}
bb2: {
_2 = const true;
goto -> bb3;
}
```
into
```
bb0: {
StorageLive(_2);
_3 = discriminant(_1);
_2 = _3 == 0;
goto -> bb3;
}
```
There are still missing components(like checking if the assignments are bools).
Was hoping that this could get some review though.
bors [Thu, 13 Aug 2020 12:43:12 +0000 (12:43 +0000)]
Auto merge of #75212 - JulianKnodt:array_map, r=LukasKalbertodt
Add `array` lang item and `[T; N]::map(f: FnMut(T) -> S)`
This introduces an `array` lang item so functions can be defined on top of `[T; N]`. This was previously not done because const-generics was not complete enough to allow for this. Now it is in a state that is usable enough to start adding functions.
The function added is a monadic (I think?) map from `[T; N] -> [S; N]`. Until transmute can function on arrays, it also allocates an extra temporary array, but this can be removed at some point.
bors [Thu, 13 Aug 2020 06:17:25 +0000 (06:17 +0000)]
Auto merge of #75431 - ehuss:platform-support, r=Mark-Simulacrum
Move platform support to the rustc book.
This moves the [Platform Support](https://forge.rust-lang.org/release/platform-support.html) page from the forge to the rustc book. There are several reasons for doing this:
* The forge is not really oriented towards end-users (it mostly contains infrastructure, governance and policy, internal team pages, etc.). This platform support page is useful to user to know which targets are supported.
* This page can now be updated in-sync with any PRs that add or remove a target, or change its status.
* This is now automatically checked on CI to verify the list does not get out of sync. Currently it only checks the presence/absence of an entry, but more sophisticated checks could be added in the future.
I'm not 100% certain this is the best location, but I think it fits. I'd like to see the rustc guide continue to grow, including things like linking information and more platform-specific details.
bors [Thu, 13 Aug 2020 04:20:51 +0000 (04:20 +0000)]
Auto merge of #75426 - ehuss:update-cargo, r=ehuss
Update cargo
7 commits in 1653f354644834073d6d2541e27fae94588e685e..ab32ee88dade1b50c77347599e82ca2de3fb8a51
2020-08-04 23:14:37 +0000 to 2020-08-10 17:44:43 +0000
- Build manpage archive deterministically (rust-lang/cargo#8600)
- doc: Qualify GNU licenses in example license field (rust-lang/cargo#8604)
- Fix jobserver_exists test on single-cpu systems (rust-lang/cargo#8598)
- Fix small typo in reference/profiles.md (rust-lang/cargo#8605)
- Default cargo publish to the alt registry if it's the only allowed one (rust-lang/cargo#8571)
- cargo install with specific yanked version gives confusing "not found" error (rust-lang/cargo#8565)
- Fix typo (rust-lang/cargo#8589)
kadmin [Thu, 6 Aug 2020 07:40:06 +0000 (07:40 +0000)]
Create lang item array and add map fn
This creates the language item for arrays, and adds the map fn which is like map in options or
iterators. It currently allocates an extra array, unfortunately.
bors [Thu, 13 Aug 2020 02:26:20 +0000 (02:26 +0000)]
Auto merge of #75476 - JohnTitor:rollup-ap1rqf1, r=JohnTitor
Rollup of 11 pull requests
Successful merges:
- #75189 (Fix wasi::fs::OpenOptions to imply write when append is on)
- #75201 (Fix some Clippy warnings in librustc_serialize)
- #75372 (Fix suggestion to use lifetime in type and in assoc const)
- #75400 (Fix minor things in the `f32` primitive docs)
- #75449 (add regression test for #74739 (mir const-prop bug))
- #75451 (Clean up E0751 explanation)
- #75455 (Use explicit path link in place for doc in time)
- #75457 (Remove some dead variants in LLVM FFI)
- #75466 (Move to intra doc links whenever possible within std/src/lib.rs)
- #75469 (Switch to intra-doc links in `std/io/mod.rs`)
- #75473 (Flip order of const & type)
Yuki Okushi [Thu, 13 Aug 2020 02:05:35 +0000 (11:05 +0900)]
Rollup merge of #75372 - estebank:lt-sugg-in-type, r=lcnr
Fix suggestion to use lifetime in type and in assoc const
_Do not merge until #75363 has landed, as it has the test case for this._
* Account for associated types
* Associated `const`s can't have generics (fix #74264)
* Do not suggest duplicate lifetimes and suggest `for<'a>` more (fix #72404)
Yuki Okushi [Thu, 13 Aug 2020 02:05:31 +0000 (11:05 +0900)]
Rollup merge of #75189 - kawamuray:bugfix-wasi-append, r=KodrAus
Fix wasi::fs::OpenOptions to imply write when append is on
This PR fixes a bug in `OpenOptions` of `wasi` platform that it currently doesn't imply write mode when only `append` is enabled.
As explained in the [doc of OpenOptions#append](https://doc.rust-lang.org/std/fs/struct.OpenOptions.html#method.append), calling `.append(true)` should imply `.write(true)` as well.
## Reproduce
Given below simple Rust program:
```rust
use std::fs::OpenOptions;
use std::io::Write;
However when I change `.write(true)` to `.append(true)`, it fails to execute by the error "Capabilities insufficient":
```sh
$ ~/wasmtime/target/debug/wasmtime run --dir=. append.wasm
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 76, kind: Other, message: "Capabilities insufficient" }', append.rs:10:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: failed to run main module `append.wasm`
...
```
This is because of lacking "rights" on the opened file:
Rich Kadel [Wed, 12 Aug 2020 22:30:41 +0000 (15:30 -0700)]
Change registered "program name" for -Cllvm-args usage messages
While debugging a codegen issue, I tried adding LLVM options with
the rustc -Cllvm-args option, and was confused by the error and usage
messaging.
The LLVM "program name" argument is set to "rustc", and command line
error messages make it look like invalid arguments are "rustc"
arguments, not LLVM.
I changed this argument so error messages and the "-help" usage feedback
is easier to understand and react to. (Clang does something similar.)
bors [Wed, 12 Aug 2020 23:03:28 +0000 (23:03 +0000)]
Auto merge of #74512 - LukasKalbertodt:debloat-copy-from-slice, r=KodrAus
Put panic code path from `copy_from_slice` into cold function
The previous `assert_eq` generated quite some code, which is especially problematic when this call is inlined. This commit also slightly improves the panic message from:
assertion failed: `(left == right)`
left: `3`,
right: `2`: destination and source slices have different lengths
...to:
source slice length (2) does not match destination slice length (3)
You can see the code bloat in assembly [here](https://rust.godbolt.org/z/74a3qo).
bors [Wed, 12 Aug 2020 20:44:19 +0000 (20:44 +0000)]
Auto merge of #75396 - RalfJung:miri-spans, r=oli-obk
Miri: improve spans of required_const failures
In https://github.com/rust-lang/rust/pull/75339 I added a loop evaluating all consts required by a function body. Unfortunately, if one of their evaluations fails, then the span used for that was that of the first statement in the function body, which happened to work form some existing test but is not sensible in general.
This PR changes it to point to the whole function instead, which is at least not wrong.
Put panic code path from `copy_from_slice` into cold function
The previous `assert_eq` generated quite some code, which is especially
problematic when this call is inlined. This commit also slightly
improves the panic message from:
assertion failed: `(left == right)`
left: `3`,
right: `2`: destination and source slices have different lengths
...to:
source slice length (2) does not match destination slice length (3)
According to [IETF RFC 4291](https://tools.ietf.org/html/rfc4291#page-10), the "IPv4-Compatible IPv6 address" is deprecated.
> 2.5.5.1. IPv4-Compatible IPv6 Address
>
> The "IPv4-Compatible IPv6 address" was defined to assist in the IPv6
> transition. The format of the "IPv4-Compatible IPv6 address" is as
> follows:
>
> | 80 bits | 16 | 32 bits |
> +--------------------------------------+--------------------------+
> |0000..............................0000|0000| IPv4 address |
> +--------------------------------------+----+---------------------+
>
> Note: The IPv4 address used in the "IPv4-Compatible IPv6 address"
> must be a globally-unique IPv4 unicast address.
>
> The "IPv4-Compatible IPv6 address" is now deprecated because the
> current IPv6 transition mechanisms no longer use these addresses.
> New or updated implementations are not required to support this
> address type.
And the current implementation of `Ipv4Addr::to_ipv6_compatible`is incorrect: it does not check whether the IPv4 address is a globally-unique IPv4 unicast address.
Please let me know if there are any issues with this pull request.
bors [Wed, 12 Aug 2020 12:21:09 +0000 (12:21 +0000)]
Auto merge of #75450 - pietroalbini:fix-toolstate, r=pietroalbini
Remove embedded-resources alumni from toolstate
Some people left the embedded-resources working group (https://github.com/rust-lang/team/pull/401), making them unassignable in toolstate issues. This PR removes them from the toolstate assignees list, fixing CI.
bors [Wed, 12 Aug 2020 06:42:49 +0000 (06:42 +0000)]
Auto merge of #75205 - Aaron1011:fix/auto-trait-proj-ice, r=nikomatsakis
Handle projection predicates in the param env for auto-trait docs
Fixes #72213
Any predicates in the param env are guaranteed to hold, so we don't need
to do any additional processing of them if we come across them as
sub-obligations of a different predicate. This allows us to avoid adding
the same predicate to the computed ParamEnv multiple times (but with
different regions each time), which causes an ambiguity error during
fulfillment.
bors [Wed, 12 Aug 2020 04:43:38 +0000 (04:43 +0000)]
Auto merge of #75436 - JohnTitor:rollup-ss0lxds, r=JohnTitor
Rollup of 9 pull requests
Successful merges:
- #74521 (older toolchains not valid anymore)
- #74960 (Fix regionck failure when converting Index to IndexMut)
- #75234 (Update asm! documentation in unstable book)
- #75368 (Move to doc links inside the prelude)
- #75371 (Move to doc links inside std/time.rs)
- #75394 (Add a function to `TyCtxt` for computing an `Allocation` for a `static` item's initializer)
- #75395 (Switch to intra-doc links in library/std/src/os/*/fs.rs)
- #75422 (Accept more safety comments)
- #75424 (fix wrong word in documentation)
Yuki Okushi [Wed, 12 Aug 2020 03:07:19 +0000 (12:07 +0900)]
Rollup merge of #75422 - poliorcetics:tidy-accept-more-safety-comments, r=Mark-Simulacrum
Accept more safety comments
This accepts more `// SAFETY:` comments from `tidy`.
This is done after the current behaviour of requiring text one the same line (because spaces are stripped so the last space never pass if there is no text on the same line) bit me once more in #75066
This could potentially accept empty `// SAFETY:` comments but `tidy` is an internal tool used only here so my reasoning is reviews will catch those.
Yuki Okushi [Wed, 12 Aug 2020 03:07:08 +0000 (12:07 +0900)]
Rollup merge of #74960 - nbdd0121:typeck, r=nikomatsakis
Fix regionck failure when converting Index to IndexMut
Fixes #74933
Consider an overloaded index expression `base[index]`. Without knowing whether it will be mutated, this will initially be desugared into `<U as Index<T>>::index(&base, index)` for some `U` and `T`. Let `V` be the `expr_ty_adjusted` of `index`.
If this expression ends up being used in any mutable context (or used in a function call with `&mut self` receiver before #72280), we will need to fix it up. The current code will rewrite it to `<U as IndexMut<V>>::index_mut(&mut base, index)`. In most cases this is fine as `V` will be equal to `T`, however this is not always true when `V/T` are references, as they may have different region.
This issue is quite subtle before #72280 as this code path is only used to fixup function receivers, but after #72280 we've made this a common path.
The solution is basically just rewrite it to `<U as IndexMut<T>>::index_mut(&mut base, index)`. `T` can retrieved in the fixup path using `node_substs`.
Yuki Okushi [Wed, 12 Aug 2020 03:07:06 +0000 (12:07 +0900)]
Rollup merge of #74521 - andjo403:readme, r=nikic
older toolchains not valid anymore
with the change to llvm 10 the parameter
LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN do not do anything as min and soft error is the same.
see https://github.com/rust-lang/llvm-project/blob/86b120e6f302d39cd6973b6391fb299d7bc22122/llvm/cmake/modules/CheckCompilerVersion.cmake