kadmin [Fri, 14 Aug 2020 00:11:36 +0000 (00:11 +0000)]
Add fix
This also explicitly checks that the types are `bool`. `try_eval_bool` also appears to just
succeed for `u8`, so this ensures that it actually is a bool before casting.
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:
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
Eric Huss [Tue, 11 Aug 2020 23:05:43 +0000 (16:05 -0700)]
Platform Support page updates.
A few updates:
- Some minor wording and formatting changes.
- Remove the `cargo` column.
- Explain the columns up-front.
- Add no-wrap on the target-triple, which looks better to me.
- Minor mention on how to install support for a built-in target via rustup.
bors [Tue, 11 Aug 2020 19:29:38 +0000 (19:29 +0000)]
Auto merge of #75421 - tmandry:rollup-ctzmzn1, r=tmandry
Rollup of 7 pull requests
Successful merges:
- #75036 (Prefer pattern matching over indexing)
- #75378 (Introduce `rustc_lexer::is_ident` and use it in couple of places)
- #75393 (Fully handle "?" shortcut)
- #75403 (Update comment for function)
- #75407 (Requested changes to [*mut T|*const T]::set_ptr_value)
- #75408 (Update MinGW comments in ci.yml)
- #75409 (Fix range term in alloc vec doc)