This also changes how variant values are printed in errors, they are no
longer printed in their parent scope. As far as I can tell, this is
leftover from pre-namespacing of enums.
Closes#17546.
Adds two error codes, one for duplicate associated constants and one for types. I'm not certain these should each have their own code, but E0201 is already solely for duplicate associated functions so at least it kinda matches. This will lead to somewhat redundant error explanations, but that's nothing new!
Fixes#23969.
Everything on this branch has passed check-stage2 on linux.
This is a temporary integration branch until [our buildbot problems](https://internals.rust-lang.org/t/buildbot-is-down-for-a-bit/2365/3) get fixed.
As the day progresses I'll merge more PRs into this branch once I get them through make check.
This branch isn't complete, keeping it up here so more people can merge PRs into integration if they want.
r? @Manishearth
Turns out for OSX our data layout was subtly wrong and the LLVM update must have
exposed this. Instead of fixing this I've removed all data layouts from the
compiler to just use the defaults that LLVM provides for all targets. All data
layouts (and a number of dead modules) are removed from the compiler here.
Custom target specifications can still provide a custom data layout, but it is
now an optional key as the default will be used if one isn't specified.
Updates our LLVM bindings to be able to write out multiple kinds of archives.
This commit also enables using LLVM instead of the system ar on all current
targets.
The C API of this function changed so it no longer takes a personality function.
A shim was introduced to call the right LLVM function (depending on which
version we're compiled against) to set the personality function on the outer
function.
The compiler only ever sets one personality function for all generated
functions, so this should be equivalent.
There's a number of goodies in this LLVM update:
* This contains a fix for https://llvm.org/bugs/show_bug.cgi?id=23957
which should help us bootstrap farther on 32-bit MSVC targets.
* There is better support for writing multiple flavors of archives, allowing us
to use the built-in LLVM support instead of the system `ar` on all current
platforms of the compiler.
* A number of other minor bug fixes and performance improvements to unblock
various other pieces of work.
When building for AArch64/Linux, __morestack ends up in the .note.GNU-stack section,
which causes missing references for the linker. By using the func/endfunc macros
from macros.S we get __morestack right to .text (and a bit more on the side).
In general, it's undesirable to have read_to_end use a buffer with uninitialized memory, as that could lead to undefined behaviour in the event of a bad Read implementation. Since we control the implementations of Read for Stdin and File, however, it should be okay for us to specialise them to improve performance. This PR is to do that!
Adds some unsafe code to deal with creating the buffers. Since the read_to_end function needed to be used from the io and fs crates, I moved it into a newly-created sys::common::io module. Alternatively we could expose the new read_to_end functions to allow people to create their own read_to_end implementations for code they trust.
Benchmarks:
Read a 2.5MB file:
sys_common::io::tests::bench_init_file ... bench: 27,473,317 ns/iter (+/- 2,490,767)
sys_common::io::tests::bench_uninit_file ... bench: 25,611,793 ns/iter (+/- 2,137,387)
Read a buffer full of constant values
sys_common::io::tests::bench_uninitialized ... bench: 12,877,645 ns/iter (+/- 931,025)
sys_common::io::tests::bench_zeroed ... bench: 18,581,082 ns/iter (+/- 1,541,108)
So, approx a 7% speedup for file reading, which I think is worthwhile.
The error now looks like this:
```
<anon>:4:9: 4:10 error: use of moved value: `x` [E0382]
<anon>:4 foo(x);
^
<anon>:3:9: 3:10 note: `x` moved here because it has type `Box<i32>`, which is moved by default
<anon>:3 let y = x;
^
<anon>:3:9: 3:10 help: use `ref` to take a reference instead:
<anon>: let ref y = x;
```
This has travis build LLVM and rustc up to stage1, but not run any tests. It seems wasteful to have the ultimate might of travis running on every PR just to check for whitespace errors. This is a pure subset of the bootstrap, so it shouldn't ever spuriously break.
`make tidy` still runs first, so we still get \"fast errors\" on bad style. However once make tidy passes, the build will simply keep running to try to make rustc. `tidy` takes ~3 mins to complete, so if your build runs longer you can be confident we've gone on to build LLVM/rustc. In principle this is configured to use ccache (it shows up in the build logs as uploaded/downloaded), but I found no actual performance changes in using it.
Maybe someone at @travis-ci knows what's up with that.
For reference, here is a successful build with ccache enabled: https://travis-ci.org/Gankro/rust/builds/70821237
and one without: https://travis-ci.org/Gankro/rust/builds/70812814
Builds seem to take about 41mins regardless.
r? @alexcrichton
This PR fixes a snippet of code on the error handling chapter of \"The Rust Programming Language\".
//cc @steveklabnik
The docs state that trying to compile the snippet will yield the following error:
```bash
anon>:13:5: 20:6 error: non-exhaustive patterns: `_` not covered [E0004]
```
But instead the error received is:
```bash
<anon>:22:46: 22:56 error: unresolved name `NewRelease`
<anon>:22 std::io::println(descriptive_probability(NewRelease));
^~~~~~~~~~
<anon>:22:5: 22:21 error: unresolved name `std::io::println`
<anon>:22 std::io::println(descriptive_probability(NewRelease));
^~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
playpen: application terminated with error code 101
```
After applying this PR the expected error is returned:
```bash
anon>:13:5: 20:6 error: non-exhaustive patterns: `_` not covered [E0004]
<anon>:13 match probability(&event) {
<anon>:14 1.00 => \"certain\",
<anon>:15 0.00 => \"impossible\",
<anon>:16 0.00 ... 0.25 => \"very unlikely\",
<anon>:17 0.25 ... 0.50 => \"unlikely\",
<anon>:18 0.50 ... 0.75 => \"likely\",
...
<anon>:13:5: 20:6 help: see the detailed explanation for E0004
error: aborting due to previous error
```
A merge in #24523 broke the explanation for E0303. This commit restores the previous version and also removes an erroneous `&` (which had nothing to do with the merge).