Clean up and add tests for slice drop shims
Adds a test for the MIR generated by `real_drop_in_place::<[T]>`. Also slightly reduces the number of statements and locals used in the shim.
r? @RalfJung
Upgrade non-LTS Ubuntu images in CI
This PR bumps `dist-various-2` to 18.04 LTS and both `x86_64-gnu` and `x86_64-gnu-debug` to 19.04.
Another change is the switch to [rust-lang/mirror-google-fuchsia-zircon](https://github.com/rust-lang/mirror-google-fuchsia-zircon) as the Zircon repository, used during Fuchsia tests: the original repository ([fuchsia.googlesource.com/zircon](https://fuchsia.googlesource.com/zircon)) is now behind a login wall and it doesn't contain anything at all.
r? @alexcrichton
cc @cramertj -- what's happening on the Fuchsia side?
Rollup of 5 pull requests
Successful merges:
- #60601 (Add a `cast` method to raw pointers.)
- #60638 (pin: make the to-module link more visible)
- #60647 (cleanup: Remove `DefIndexAddressSpace`)
- #60656 (Inline some Cursor calls for slices)
- #60657 (Stabilize and re-export core::array in std)
Failed merges:
r? @ghost
This commit removes the modification of the mutability of simple
bindings. While the mutability isn't used, it is important that it is
kept so that the input to procedural macros matches what the user wrote.
This commit also modifies the span of the binding mode so that it is
considered a compiler desugaring and won't be linted against for being
unused..
Inline some Cursor calls for slices
(Partially) brings back https://github.com/rust-lang/rust/pull/33921
I've noticed in some serialization code I was writing that writes to slices produce much, much, worse code than you'd expect even with optimizations turned on. For example, you'd expect something like this to be zero cost:
```
use std::io::{self, Cursor, Write};
pub fn serialize((a, b): (u64, u64)) -> [u8;8+8] {
let mut r = [0u8;16];
{
let mut w = Cursor::new(&mut r[..]);
w.write(&a.to_le_bytes()).unwrap();
w.write(&b.to_le_bytes()).unwrap();
}
r
}
```
...but it compiles down to [dozens of instructions](https://rust.godbolt.org/z/bdwDzb) because the `slice_write()` calls aren't inlined, which in turn means `unwrap()` can't be optimized away, and so on.
To be clear, this pull-req isn't sufficient by itself: if we want to go down that path we also need to add `#[inline]`'s to the default implementations for functions like `write_all()` in the `Write` trait and so on, or implement them separately in the `Cursor` impls. But I figured I'd start a conversation about what tradeoffs we're expecting here.
cleanup: Remove `DefIndexAddressSpace`
The scheme with two address spaces for `DefIndex` was needed in the past, but apparently not needed anymore (after removing `DefId`s from locals and `HirId`-ification).
Add a `cast` method to raw pointers.
This is similar to `NonNull::cast`.
Compared to the `as` operator (which has a wide range of meanings depending on the input and output types), a call to this method:
* Can only go from a raw pointer to a raw pointer
* Cannot change the pointer’s `const`ness
… even when the pointed types are inferred based on context.
The canonical repository on fuchsia.googlesource.com is not accessible
anymore, neither for anonymous access nor logged in access. This commit
switches our CI to fetch the repository from our own mirror.
Rollup of 8 pull requests
Successful merges:
- #59979 (to_xe_bytes for isize and usize returns an array of different size)
- #60491 (std: Update compiler-builtins crate)
- #60550 (Add tests for concrete const types)
- #60572 (Add test for #59972)
- #60627 (test for #50518)
- #60634 (Document + Cleanup lang_items.rs)
- #60641 (Instead of ICEing on incorrect pattern, use delay_span_bug)
- #60644 (Use `delay_span_bug` for "Failed to unify obligation")
Failed merges:
r? @ghost
test for #50518
It was fixed somewhere between 1.28.0 and 1.31.1
closes#50518
r? @estebank
Where's the best place to add this test? I *think* we want "compile-pass" for this test (no need to run a binary, and not running saves us a millisecond of process creation) , but there's no compile-pass anymore.
Should this be UI test with empty stdout, stderr and zero return code?
std: Update compiler-builtins crate
Pulls in a fix for ensuring that wasm targets have code in
compiler-builtins for `ldexp` which LLVM can generate references to.
libprofiler_builtins: Set compilation flags more correctly for C code.
In particular, set `COMPILER_RT_HAS_FCNTL_LCK` and `COMPILER_RT_HAS_ATOMICS` as appropriate. This should get rid of the various runtime warnings when executing instrumented binaries.
The build script is using a heuristic here that hopefully is sufficient for the time being.
r? @alexcrichton
Fixes#59531.
conditionally modify darwin targets to macosx targets with versions
We need this behavior so that Rust LLVM IR objects match the target triple for Clang LLVM IR objects. This matching then convinces the linker that yes, you really can do cross-language LTO with objects from different compilers.
The newly-added tests seem to pass locally on x86_64-unknown-linux-gnu. I haven't done a full test run or tried the new compiler in an cross-language LTO setup yet.