improve the TryFrom implementations
This removes the need for a 128 bit storage by making use of the fact that there can be either no over/underflow, either one or both, and each time the target type suffices to hold the limit for comparison. This also means that the implementation will work in targets without 128bit support (unless it's for 128bit types, of course).
The downside is that the code looks a bit more complex.
This removes the need for a 128 bit storage by making use of the fact that
there can be either no over/underflow, either one or both, and each time
the target type suffices to hold the limit for comparison.
The downside is that the code looks a bit more complex.
This test code included in this commit is from @oyvindln 's PR. They also
greatly helped fixing a number of errors I made along the way. Thanks a lot!
rustc: Add some build scripts for librustc crates
This commit adds some "boilerplate" build scripts to librustc/libsyntax crates
to declare dependencies on various environment variables that are configured
throughout the build. Cargo recently gained the ability to depend on environment
variables in build scripts which can help trigger recompilation of a crate.
This should fix weird bugs where after you make a commit or a few days later
you'll get weird "not built with the same compiler" errors hopefully.
Add a missing verb to the description of std::process::ExitStatus::success()
"Signal termination not considered" -> "Signal termination **is** not considered"
The first line of the description was rewrapped so it fits into 80 characters.
Clarify that sort_unstable is deterministic
@frankmcsherry complained that the documentation said "it is randomized but deterministic", which is a contradictory statement.
This PR uses a different and clearer wording.
Fix docs: BufReader/File doesn't need to be mut
Neither `BufReader` nor `File` need to be declared `mut` for most of these examples. The cookbook example using `BufReader` doesn't declare them as `mut` either (https://brson.github.io/rust-cookbook/basics.html#ex-std-read-lines).
Remove unused DefPathTable::retrace_path()
`DefPathTable::retrace_path()` is not used anymore for a while now and removing it also removes the need to build the costly `DefPathTable::key_to_index` map for every upstream crate.
cc #43300
r? @eddyb
Document use of `compiler_builtins` with `no_std` binaries
See discussion in #43264.
The docs for the `compiler_builtins_lib` feature were removed in
PR #42899. But, though the `compiler_builtins` library has been
migrated out-of-tree, the language feature remains, and is needed to
use the stand-alone crate. So, we reintroduce the docs for the
feature, and add a reference to them when describing how to create a
`no_std` executable.
configure: allow distros to disable debuginfo-only-std
This allows builders to generate debugging information for everything, even in a stable release build. This is useful for distros like Fedora (already carrying a [similar patch](https://src.fedoraproject.org/cgit/rpms/rust.git/tree/rust-1.16.0-configure-no-override.patch)) and Debian that automatically put all debuginfo in separate "debug symbol" packages.
This commit preserves the default behaviour of switching these on when a non-dev channel is selected, but allows the user to override this via the `./configure` command line.
In theory, one could also do this via `bootstrap/config.toml` but it doesn't work currently due to #43295.
rustdoc: fix layout of Fields section in documentation for unions
Previously, the union fields would all render on the same line with
hideous spacing; comparison to the analogous section for structs makes
it undoubtable that `display: block` is the true intent.
Concisely and definitively resolves#43404 and its perfidious
malignancy.
Add #[derive(Clone)] to TokenTreeIter
I've found this useful for writing backtracking parsers.
The underlying `Cursor` implements `Clone` already, so it's just a matter of adding `#[derive(Clone)]` to the type.
r? @jseyfried
Add generic example of std::ops::Sub in doc comments
This PR adds an example of using generics with std::ops::Sub and is a follow up of PR #41612 and is related to issue #29365. I also wanted to add examples to Mul and Div, but I think these two traits are already loaded with examples.
Point at `:` when using it instead of `;`
When triggering type ascription in such a way that we can infer a
statement end was intended, add a suggestion for the change. Always
point out the reason for the expectation of a type is due to type
ascription.
Fix#42057, #41928.
Previously, the union fields would all render on the same line with
hideous spacing; comparison to the analogous section for structs makes
it undoubtable that `display: block` is the true intent.
Concisely and definitively resolves#43404 and its perfidious
malignancy.
Improve panic docs for Instant::duration_since
The docs for Instant::duration_since has a confusing section on panicking. It's
much more clear without the second two sentences of description.
This commit adds some "boilerplate" build scripts to librustc/libsyntax crates
to declare dependencies on various environment variables that are configured
throughout the build. Cargo recently gained the ability to depend on environment
variables in build scripts which can help trigger recompilation of a crate.
This should fix weird bugs where after you make a commit or a few days later
you'll get weird "not built with the same compiler" errors hopefully.
Update Rust LLVM bindings for LLVM 5.0
This is the initial set of changes to update the rust llvm bindings for 5.0. The llvm commits necessitating these changes are linked from the tracking issue, #43370.
Ignore stack probe tests on AArch64
Stack probes are only implemented for x86, and as such currently fail on AArch64. This patch ignores those tests on this architecture.
Fixes#43356.
r? @alexcrichton
Rework Rustbuild to an eagerly compiling approach
This introduces a new dependency on `serde`; I don't believe that's a problem since bootstrap is compiled with nightly/beta always so proc macros are available. Compile times are slightly longer -- about 2-3x (30 seconds vs. 10 seconds). I don't think this is too big a problem, especially since recompiling bootstrap is somewhat rare. I think we can remove the dependency on Serde if necessary, though, so let me know.
r? @alexcrichton
std: Cut down #[inline] annotations where not necessary
This PR cuts down on a large number of `#[inline(always)]` and `#[inline]`
annotations in libcore for various core functions. The `#[inline(always)]`
annotation is almost never needed and is detrimental to debug build times as it
forces LLVM to perform inlining when it otherwise wouldn't need to in debug
builds. Additionally `#[inline]` is an unnecessary annoation on almost all
generic functions because the function will already be monomorphized into other
codegen units and otherwise rarely needs the extra "help" from us to tell LLVM
to inline something.
Overall this PR cut the compile time of a [microbenchmark][1] by 30% from 1s to
0.7s.
[1]: https://gist.github.com/alexcrichton/a7d70319a45aa60cf36a6a7bf540dd3a
Pass debugging arguments to emcc
Tells emcc to enable assertions and debugging information for
wasm32-experimental-emscripten. This makes the codegen issues caused by
LLVM bug 33824 manifest more frequently at runtime and improves the wasm
debugging experience.
Less verbose output for unused arguments
Closes#37718
This is my first contribution to rust, so sorry if I'm missing anything!
The output now looks like this:
<img width="831" alt="screen shot 2017-07-18 at 5 01 32 pm" src="https://user-images.githubusercontent.com/12972285/28347566-dbfa9962-6c05-11e7-8730-c2e8062a04cc.png">
It's not the prettiest, but whenever #41850 gets resolved, this should be able to be improved.
**EDIT:** This also does not seem
r? @Mark-Simulacrum