bors [Tue, 4 Aug 2020 09:18:22 +0000 (09:18 +0000)]
Auto merge of #75095 - pietroalbini:fallible-fast-fail, r=Mark-Simulacrum
ci: disable fast-fail on auto-fallible
The purpose of the auto-fallible job is to run builders that are likely to fail on CI without gating on them. Having fast-fail enabled there kinda defeats the purpose, as if one of them fails we can't monitor the outcome of the other ones.
This was prompted by the aarch64-gnu builder consistently failing due to a broken test, preventing us from seeing if the macOS spurious failure is fixed.
Pietro Albini [Mon, 3 Aug 2020 08:32:47 +0000 (10:32 +0200)]
ci: disable fail-fast on auto-fallible
The purpose of the auto-fallible job is to run builders that are likely
to fail on CI without gating on them. Having fail-fast enabled there
kinda defeats the purpose, as if one of them fails we can't monitor the
outcome of the other ones.
This was prompted by the aarch64-gnu builder consistently failing due to
a broken test, preventing us from seeing if the macOS spurious failure
is fixed.
bors [Tue, 4 Aug 2020 05:37:44 +0000 (05:37 +0000)]
Auto merge of #75111 - mati865:use-lld-option, r=Mark-Simulacrum
Make rust.use-lld config option work with non MSVC targets
Builds fine and passes tests on Linux.
Not overriding `use-lld` by `linker` makes sense on those platforms since very old GCC versions don't understand `-fuse-ld=lld`. This allows pointing to newer GCC or Clang that will know how to call LLD.
bors [Tue, 4 Aug 2020 01:48:32 +0000 (01:48 +0000)]
Auto merge of #75126 - JohnTitor:rollup-aejluzx, r=JohnTitor
Rollup of 8 pull requests
Successful merges:
- #74759 (add `unsigned_abs` to signed integers)
- #75043 (rustc_ast: `(Nested)MetaItem::check_name` -> `has_name`)
- #75056 (Lint path statements to suggest using drop when the type needs drop)
- #75081 (Fix logging for rustdoc)
- #75083 (Do not trigger `unused_braces` for `while let`)
- #75084 (Stabilize Ident::new_raw)
- #75103 (Disable building rust-analyzer on riscv64)
- #75106 (Enable docs on in the x86_64-unknown-linux-musl manifest)
Yuki Okushi [Tue, 4 Aug 2020 00:27:10 +0000 (09:27 +0900)]
Rollup merge of #75106 - etherealist:docs_manifest, r=Mark-Simulacrum
Enable docs on in the x86_64-unknown-linux-musl manifest
Add the rust-docs component to toolchain x86_64-unknown-linux-musl, which allows people using rustup on their musl-based linux distribution to download the rust-docs.
Generating and uploading the docs was enabled in b5d143b (#74871).
In #75102 @Mark-Simulacrum found that we are uploading the docs, but the correct manifest is missing.
* The relevant call to build-manifest seems to be [in bootstrap](https://github.com/rust-lang/rust/blob/c058a8b8dc5dea0ed9b33e14da9e317e2749fcd7/src/bootstrap/dist.rs#L2334)
* The manifest is then used in [promote-release crontab](https://github.com/rust-lang/rust-central-station/blob/master/crontab)
Yuki Okushi [Tue, 4 Aug 2020 00:27:08 +0000 (09:27 +0900)]
Rollup merge of #75103 - Mark-Simulacrum:no-ra-for-riscv64, r=matklad
Disable building rust-analyzer on riscv64
riscv64 has an LLVM bug that makes rust-analyzer not build. Should permit future rust-analyzer ups (e.g., https://github.com/rust-lang/rust/pull/74813) to land.
bors [Mon, 3 Aug 2020 23:57:50 +0000 (23:57 +0000)]
Auto merge of #74695 - alexcrichton:more-wasm-float-cast-fixes, r=nagisa
rustc: Improving safe wasm float->int casts
This commit improves code generation for WebAssembly targets when
translating floating to integer casts. This improvement is only relevant
when the `nontrapping-fptoint` feature is not enabled, but the feature
is not enabled by default right now. Additionally this improvement only
affects safe casts since unchecked casts were improved in #74659.
Some more background for this issue is present on #73591, but the
general gist of the issue is that in LLVM the `fptosi` and `fptoui`
instructions are defined to return an `undef` value if they execute on
out-of-bounds values; they notably do not trap. To implement these
instructions for WebAssembly the LLVM backend must therefore generate
quite a few instructions before executing `i32.trunc_f32_s` (for
example) because this WebAssembly instruction traps on out-of-bounds
values. This codegen into wasm instructions happens very late in the
code generator, so what ends up happening is that rustc inserts its own
codegen to implement Rust's saturating semantics, and then LLVM also
inserts its own codegen to make sure that the `fptosi` instruction
doesn't trap. Overall this means that a function like this:
#[no_mangle]
pub unsafe extern "C" fn cast(x: f64) -> u32 {
x as u32
}
This PR improves the situation by updating the code generation for
float-to-int conversions in rustc, specifically only for WebAssembly
targets and only for some situations (float-to-u8 still has not great
codegen). The fix here is to use basic blocks and control flow to avoid
speculatively executing `fptosi`, and instead LLVM's raw intrinsic for
the WebAssembly instruction is used instead. This effectively extends
the support added in #74659 to checked casts. After this commit the
codegen for the above Rust function looks like:
So we're relatively close to the original codegen, although it's
slightly different because the semantics of the function changed where
we're emulating the `i32.trunc_sat_f32_s` instruction rather than always
replacing out-of-bounds values with zero.
There is still work that could be done to improve casts such as `f32` to
`u8`. That form of cast still uses the `fptosi` instruction which
generates lots of branch-y code. This seems less important to tackle now
though. In the meantime this should take care of most use cases of
floating-point conversion and as a result I'm going to speculate that
this...
bors [Mon, 3 Aug 2020 15:46:02 +0000 (15:46 +0000)]
Auto merge of #74827 - ssomers:btree_cleanup_insert, r=Mark-Simulacrum
Move bulk of BTreeMap::insert method down to new method on handle
Adjust the boundary between the map and node layers for insertion: do more in the node layer, keep root manipulation and pointer dereferencing separate. No change in undefined behaviour or performance.
David Sonder [Mon, 3 Aug 2020 14:02:20 +0000 (16:02 +0200)]
Enable docs on in the x86_64-unknown-linux-musl manifest
Add the rust-docs component to toolchain x86_64-unknown-linux-musl, which allows
people using rustup on their musl-based linux distribution to download the
rust-docs.
Generating and uploading the docs was enabled in b5d143b.
bors [Mon, 3 Aug 2020 01:50:25 +0000 (01:50 +0000)]
Auto merge of #74969 - nnethercote:rm-GCX_PTR, r=Mark-Simulacrum
Remove `GCX_PTR`.
We store an `ImplicitCtxt` pointer in a thread-local value (TLV). This allows
implicit access to a `GlobalCtxt` and some other things.
We also store a `GlobalCtxt` pointer in `GCX_PTR`. This is always the same
`GlobalCtxt` as the one within the `ImplicitCtxt` pointer in TLV. `GCX_PTR`
is only used in the parallel compiler's `handle_deadlock()` function.
This commit does the following.
- It removes `GCX_PTR`.
- It also adds `ImplicitCtxt::new()`, which constructs an `ImplicitCtxt` from a
`GlobalCtxt`. `ImplicitCtxt::new()` + `tls::enter_context()` is now
equivalent to the old `tls::enter_global()`.
- Makes `tls::get_tlv()` public for the parallel compiler, because it's
now used in `handle_deadlock()`.
bors [Sun, 2 Aug 2020 23:55:12 +0000 (23:55 +0000)]
Auto merge of #74948 - lzutao:stalize-result-as-deref, r=dtolnay
Stabilize `Result::as_deref` and `as_deref_mut`
FCP completed in https://github.com/rust-lang/rust/issues/50264#issuecomment-645681400.
This PR stabilizes two new APIs for `std::result::Result`:
```rust
fn as_deref(&self) -> Result<&T::Target, &E> where T: Deref;
fn as_deref_mut(&mut self) -> Result<&mut T::Target, &mut E> where T: DerefMut;
```
This PR also removes two rarely used unstable APIs from `Result`:
```rust
fn as_deref_err(&self) -> Result<&T, &E::Target> where E: Deref;
fn as_deref_mut_err(&mut self) -> Result<&mut T, &mut E::Target> where E: DerefMut;
```
We store an `ImplicitCtxt` pointer in a thread-local value (TLV). This allows
implicit access to a `GlobalCtxt` and some other things.
We also store a `GlobalCtxt` pointer in `GCX_PTR`. This is always the same
`GlobalCtxt` as the one within the `ImplicitCtxt` pointer in TLV. `GCX_PTR`
is only used in the parallel compiler's `handle_deadlock()` function.
This commit does the following.
- It removes `GCX_PTR`.
- It also adds `ImplicitCtxt::new()`, which constructs an `ImplicitCtxt` from a
`GlobalCtxt`. `ImplicitCtxt::new()` + `tls::enter_context()` is now
equivalent to the old `tls::enter_global()`.
- Makes `tls::get_tlv()` public for the parallel compiler, because it's
now used in `handle_deadlock()`.
bors [Sun, 2 Aug 2020 22:07:32 +0000 (22:07 +0000)]
Auto merge of #75070 - Manishearth:rollup-2kgcaw5, r=Manishearth
Rollup of 5 pull requests
Successful merges:
- #74980 (pprust: adjust mixed comment printing and add regression test for #74745)
- #75009 (Document the discrepancy in the mask type for _mm_shuffle_ps)
- #75031 (Do not trigger `unused_{braces,parens}` lints with `yield`)
- #75059 (fix typos)
- #75064 (compiletest: Support ignoring tests requiring missing LLVM components)
Rollup merge of #75064 - petrochenkov:llvmtarg, r=Mark-Simulacrum
compiletest: Support ignoring tests requiring missing LLVM components
This PR implements a more principled solution to the problem described in https://github.com/rust-lang/rust/pull/66084.
Builds of LLVM backends take a lot of time and disk space.
So it usually makes sense to build rustc with
```toml
[llvm]
targets = "X86"
experimental-targets = ""
```
unless you are working on some target-specific tasks.
A few tests, however, require non-x86 backends to be built.
A new test directive `// needs-llvm-components: component1 component2 component3` makes such tests to be automatically ignored if one of the listed components is missing in the provided LLVM (this is determined through `llvm-config --components`).
As a result, the test suite now fully passes with LLVM built only with the x86 backend. The component list in this case is
```
aggressiveinstcombine all all-targets analysis asmparser asmprinter binaryformat bitreader bitstreamreader bitwriter cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker engine executionengine frontendopenmp fuzzmutate globalisel instcombine instrumentation interpreter ipo irreader jitlink libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mirparser native nativecodegen objcarcopts object objectyaml option orcerror orcjit passes profiledata remarks runtimedyld scalaropts selectiondag support symbolize tablegen target textapi transformutils vectorize windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xray
```
Rollup merge of #74980 - davidtwco:issue-74745-pprust-regression-test, r=petrochenkov
pprust: adjust mixed comment printing and add regression test for #74745
Fixes #74745.
This PR adds a regression test for #74745. While a `ignore-tidy-trailing-lines` header is required, this doesn't stop the test from reproducing, so long as there is no newline at the end of the file.
However, adding the header comments made the test fail due to a bug in pprust - so this PR also adjusts the pretty printing of mixed comments so that the initial zero-break isn't emitted at the beginning of the line. Through this, the `block-comment-wchar` test can have the `pp-exact` file removed, as it no longer converges from pretty printing of the source.
bors [Sun, 2 Aug 2020 18:01:27 +0000 (18:01 +0000)]
Auto merge of #74963 - JohnTitor:ptn-ice, r=petrochenkov
Fix ICEs with `@ ..` binding
This reverts #74557 and introduces an alternative fix while ensuring that #74954 is not broken.
The diagnostics are verbose though, it fixes three related issues.
cc #74954, #74539, and #74702
bors [Sun, 2 Aug 2020 16:06:54 +0000 (16:06 +0000)]
Auto merge of #75060 - JohnTitor:rollup-aq8sfxf, r=JohnTitor
Rollup of 10 pull requests
Successful merges:
- #74686 (BTreeMap: remove into_slices and its unsafe block)
- #74762 (BTreeMap::drain_filter should not touch the root during iteration)
- #74781 (Clean up E0733 explanation)
- #74874 (BTreeMap: define forget_type only when relevant)
- #74974 (Make tests faster in Miri)
- #75010 (Update elasticlunr-rs and ammonia transitive deps)
- #75041 (Replaced log with tracing crate)
- #75044 (Clean up E0744 explanation)
- #75054 (Rename rustc_middle::cstore::DepKind to CrateDepKind)
- #75057 (Avoid dumping rustc invocations to stdout)
Failed merges:
- #74827 (Move bulk of BTreeMap::insert method down to new method on handle)
Yuki Okushi [Sun, 2 Aug 2020 16:05:28 +0000 (01:05 +0900)]
Rollup merge of #75057 - Mark-Simulacrum:avoid-long-print, r=alexcrichton
Avoid dumping rustc invocations to stdout
These are quite long, usually, and in most cases not interesting. On smaller
terminals they can take up more than a full page of output, hiding the error
diagnostics emitted.
Yuki Okushi [Sun, 2 Aug 2020 16:05:18 +0000 (01:05 +0900)]
Rollup merge of #74874 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
BTreeMap: define forget_type only when relevant
Similar to `forget_node_type` for handles.
No effect on generated code, apart maybe from the superfluous calls that might not have been optimized away.
Yuki Okushi [Sun, 2 Aug 2020 16:05:13 +0000 (01:05 +0900)]
Rollup merge of #74762 - ssomers:btree_no_root_in_remove_kv_tracking, r=Mark-Simulacrum
BTreeMap::drain_filter should not touch the root during iteration
Although Miri doesn't point it out, I believe there is undefined behaviour using `drain_filter` when draining the 11th-last element from a tree that was larger. When this happens, the last remaining child nodes are merged, the root becomes empty and is popped from the tree. That last step establishes a mutable reference to the node elected root and writes a pointer in `node::Root`, while iteration continues to visit the same node.
This is mostly code from #74437, slightly adapted.
Mark Rousskov [Sun, 2 Aug 2020 14:54:13 +0000 (10:54 -0400)]
Avoid dumping rustc invocations to stdout
These are quite long, usually, and in most cases not interesting. On smaller
terminals they can take up more than a full page of output, hiding the error
diagnostics emitted.
David Wood [Sun, 2 Aug 2020 14:31:06 +0000 (15:31 +0100)]
compiletest: print diff for pretty tests
This commit modifies compiletest so that a diff of actual and expected
output is shown for pretty tests. This makes it far easier to work out
what has changed.
David Wood [Fri, 31 Jul 2020 13:53:44 +0000 (14:53 +0100)]
tests: add regression test for #74745
This commit adds a regression test for #74745. While a
`ignore-tidy-trailing-lines` header is required, this doesn't stop the
test from reproducing, so long as there is no newline at the end of the
file.
However, adding the header comments made the test fail due to a bug in
pprust, fixed in the previous commit.
David Wood [Sun, 2 Aug 2020 14:27:03 +0000 (15:27 +0100)]
pprust: adjust mixed comment printing
This commit adjusts the pretty printing of mixed comments so that the
initial zero-break isn't emitted at the beginning of the line. Through
this, the `block-comment-wchar` test can have the `pp-exact` file
removed, as it no longer converges from pretty printing of the source.
bors [Sun, 2 Aug 2020 12:20:09 +0000 (12:20 +0000)]
Auto merge of #74210 - estebank:type-ascriptomatic, r=petrochenkov
Deduplicate `::` -> `:` typo errors
Deduplicate errors caused by the same type ascription typo, including
ones suggested during parsing that would get reported again during
resolve. Fix #70382.
bors [Sun, 2 Aug 2020 09:41:17 +0000 (09:41 +0000)]
Auto merge of #74972 - second-state:wasi-right-fix, r=KodrAus
Fix std::fs::File::metadata permission on WASI target
Previously `std::fs::File::metadata` on wasm32-wasi would call `fd_filestat_get`
to get metadata associated with fd, but that fd is opened without
RIGHTS_FD_FILESTAT_GET right, so it will failed on correctly implemented WASI
environment.
This change instead to add the missing rights when opening an fd.
bors [Sat, 1 Aug 2020 20:43:12 +0000 (20:43 +0000)]
Auto merge of #74726 - oli-obk:tracing, r=Mark-Simulacrum
Move from `log` to `tracing`
The only visible change is that we now get timestamps in our logs:
```
Jul 24 18:41:01.065 TRACE rustc_mir::transform::const_prop: skipping replace of Rvalue::Use(const () because it is already a const
Jul 24 18:41:01.065 TRACE rustc_mir::transform::const_prop: propagated into _2
Jul 24 18:41:01.065 TRACE rustc_mir::transform::const_prop: visit_constant: const ()
```
This PR was explicitly designed to be as low-impact as possible. We can now move to using the name `tracing` insteads of `log` on a crate-by-crate basis and use any of the other tracing features where desirable.
As far as I can tell this will allow tools to seamlessly keep working (since they are using `rustc_driver::init_log...`).
This is the first half of step 1 of the accepted `tracing` MCP (https://github.com/rust-lang/compiler-team/issues/331)