Add Gankro's table to nomicon/src/phantom-data.md
Original: https://github.com/rust-lang/rust/issues/30069#issuecomment-159928136
Testing confirms that:
- `PhantomData<fn() -> T>` does not actually enable drop checking.
- `PhantomData<fn(T) -> T>` is neither variant nor contravariant.
trans: don't ICE when trying to create ADT trans-items
ADTs are translated in-place from rustc_trans::callee, so no trans-items
are needed.
This fix will be superseded by the shimmir branch, but I prefer not to
backport that to beta.
Fixes#39823.
Beta-nominating because regression.
r? @michaelwoerister
add `-C overflow-checks` option
In addition to defining and handling the new option, we also add a method on librustc::Session for determining the necessity of overflow checks. This method provides a single point to sort out the three (!) different ways for turning on overflow checks: -C debug-assertions, -C overflow-checks, and -Z force-overflow-checks.
I was seeing a [run-pass/issue-28950.rs](b1363a73ed/src/test/run-pass/issue-28950.rs) failure on my machine with these patches, but I was also seeing the failure without the changes to the core compiler. We'll see what travis says.
Fixes#33134. r? @alexcrichton
Added test for inclusive_range_syntax in compile-fail test suite
Fixes#39059
r? @est31
Forgot to leave a comment on the issue, hopefully nobody else is working on this one!
Switch Fuchsia to readdir (instead of readdir_r)
The readdir_r function is deprecated on newer Posix systems because of
various problems, and not implemented at all for Fuchsia. There are
already implementations using both, and this patch switches Fuchsia
over to the readdir-based one.
Fixes#40021 for Fuchsia, but that issue also contains discussion of
what should happen for other Posix systems.
travis: Compile a more compatible libc.a for musl
The mitigations for #34978 involve passing `-Wa,-mrelax-relocations=no` to all C
code we compile, and we just forgot to pass it when compiling musl itself.
Closes#39979
Set metadata for vtable-related loads
Give LLVM much more information about vtable pointers. Without the extra
information, LLVM has to be rather pessimistic about vtables, preventing
a number of obvious optimisations.
* Makes the vtable pointer argument noalias and readonly.
* Marks loads of the vtable pointer as nonnull.
* Marks load from the vtable with `!invariant.load` metadata.
Fixes#39992
Simplify/fix adaptive hashmap
Please see https://github.com/rust-lang/rust/pull/38368#issuecomment-280957863 for context.
The shift length math is broken. It turns out that checking for the shift length is complicated. Using simulations it's possible to see that a value of 2000 will only get probabilities down to ~1e-7 when the hashmap load factor is 90% (rust goes up to 90.9% as of today). That's probably not good enough to go into the stdlib with pluggable hashers.
So this PR simplify the adaptive behavior to only consider displacement, which is much safer and very useful by itself.
There's two comments because one of them is already being tested to be merged by bors.
check_match: don't treat privately uninhabited types as uninhabited
Fixes#38972, which is a regression in 1.16 from @canndrew's patchset.
r? @nikomatsakis
beta-nominating because regression.
Fix compilation on Redox
This updates the Redox sys module to fix compilation.
The functions peek and peek_from are added to TcpStream and UdpSocket as stubs. The sys::backtrace module is now included correctly
Use ARM instead of SystemZ for testing uninstalled targets
This needs some explanation.
`config.toml` has section `targets` listing backends that are built during LLVM build:
```
targets = "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX"
```
It would be reasonable to expect that `targets = "X86"` would be enough for doing a local build in typical case (building on x86 and not working on some non-x86 platform-specific functionality).
However, for `x.py test` to pass successfully you have to add ARM and SystemZ to the target list as well (`targets = "X86;ARM;SystemZ"`), because two tests (`compile-fail/issue-37131.rs` and `run-make\target-without-atomics`) require these architectures to be enabled in LLVM.
This patch moves `compile-fail/issue-37131.rs` from SystemZ to ARM, so `targets = "X86;ARM"` becomes sufficient for running the full test suite without errors.
Follow rename of mx_handle_wait Magenta syscalls
The mx_handle_wait_* syscalls in Magenta were renamed to
mx_object_wait. The syscall is used in the Magenta/Fuchsia
implementation of std::process, to wait on child processes.
In addition, this patch enables the use of the system provided
libbacktrace library on Fuchsia targets. Symbolization is not yet
working, but at least it allows printing hex addresses in a backtrace
and makes building succeed when the backtrace feature is not disabled.
[rustbuild] add a way to run command after failure
This is a simple way to workaround the debugging issues caused by the rustc
wrapper used in the bootstrap process. Namely, it uses some obscure environment
variables and you can't just copy the failed command and run it in the shell or
debugger to examine the failure more closely.
With `--on-fail` its possible to run an arbitrary command within exactly the
same environment under which rustc failed. Theres's multiple ways to use this
new flag:
$ python x.py build --stage=1 --on-fail=env
would print a list of environment variables and the failed command, so a
few copy-pastes and you now can run the same rust in your shell outside the
bootstrap system.
$ python x.py build --stage=1 --on-fail=bash
Is a more useful variation of the command above in that it launches a whole
shell with environment already in place! All that's left to do is copy-paste
the command just above the shell prompt!
Fixes#38686Fixes#38221
Update sccache binaries on CI
Currently CI builds can fail spuriously during the LLVM build (#39003). I
believe this is due to sccache, and I believe that in turn was due to the fact
that the sccache server used to just be a raw mio server. Historically raw mio
servers are quite complicated to get right, but this is why we built Tokio! The
sccache server has been migrated to Tokio which I suspect would fix any latent
issues.
I have no confirmation of this (never been able to reproduce the deadlock
locally), but my hunch is that updating sccache to the master branch will fix
the timeouts during the LLVM build.
The binaries previously came from Gecko's infrastructure, but I've built new
ones by hand for Win/Mac/Linux and uploaded them to our CI bucket.
Currently CI builds can fail spuriously during the LLVM build (#39003). I
believe this is due to sccache, and I believe that in turn was due to the fact
that the sccache server used to just be a raw mio server. Historically raw mio
servers are quite complicated to get right, but this is why we built Tokio! The
sccache server has been migrated to Tokio which I suspect would fix any latent
issues.
I have no confirmation of this (never been able to reproduce the deadlock
locally), but my hunch is that updating sccache to the master branch will fix
the timeouts during the LLVM build.
The binaries previously came from Gecko's infrastructure, but I've built new
ones by hand for Win/Mac/Linux and uploaded them to our CI bucket.
Fix test caching on Windows/GNU
Addresses https://github.com/rust-lang/rust/issues/36385#issuecomment-277131231
Previously the sysroot directory was purged on every build and mingw startup objects were rebuilt unconditionally and always triggered test reruns.
Now mingw startup objects are built in the native directory and then copied into the sysroot directory. They are also rebuilt only when necessary, so test caching works.
Correct another typo in procedural macros chapter of the Book.
Another (and the only remaining) instance of the lets/let's mistake fixed in c8292fc / 36b00cf.
r? @steveklabnik
Update std::fmt module docs for landing of #33642.
Since #33642, it's no longer true that all references to a given format argument must use the same type. The docs don't seem to have been updated.
Clarify thread::Builder::stack_size docs
Add two pieces of information:
* the size is in bytes
* the actual stack size might be bigger.
Also change the example to use a more realistic value of 32 kilobytes.
r? @steveklabnik
Fix indentation of error message
So I just encountered this error for the first time. It's unclear what
it means, why I encountered it, or how to fix it. But worst of all, it
has a random newline and weird indentation! This commit fixes that last
bit.
<img width="680" alt="screen shot 2017-02-18 at 4 35 36 pm" src="https://cloud.githubusercontent.com/assets/1529387/23097087/0ef5ac4a-f5f9-11e6-9132-18ce759f7092.png">
Add Documentation for Custom Attributes and Error Reporting in Procedural Macros
This fixes#39821 .
I'm not sure if the process of how to access custom attributes should be documented as well.
But I feel, that this should rather be documented in `syn`
book: binary prefixed are defined by IEC and not in SI
Binary prefixes (such as Gi for ‘gibi-’ in GiB) are defined by
International Electrotechnical Commission (IEC) and not in the
International System of Units (SI).
Though to be honest I’d just reword the previous paragraph to use ‘1 GiB’.
test: Verify all sysroot crates are unstable
As we continue to add more crates to the compiler and use them to implement
various features we want to be sure we're not accidentally expanding the API
surface area of the compiler! To that end this commit adds a new `run-make` test
which will attempt to `extern crate foo` all crates in the sysroot, verifying
that they're all unstable.
This commit discovered that the `std_shim` and `test_shim` crates were
accidentally stable and fixes the situation by deleting those shims. The shims
are no longer necessary due to changes in Cargo that have happened since they
were originally incepted.