Fix printing regions with -Z verbose
When dumping MIR with `-Z verbose`, it would print regions on types, but not in the code. It seems the Rvalue printing code tried to be smart and guessed when the `Display` for `Region` would not possibly print anything.
This PR makes it no longer be smart, and just always use the `Display` like all the other code (e.g. printing types) does.
add a note to Vec's Extend<&T> impl about its slice specialization
From the regular documentation view, it's not at all apparent that [this specialization](5669c9988f/src/liballoc/vec.rs (L1879-L1891)) exists for `slice::Iter`. This adds a documentation blurb to the Extend impl itself to note that this optimization exists.
Point at path segment on module not found
Point at the correct path segment on a import statement where a module
doesn't exist.
New output:
```rust
error[E0432]: unresolved import `std::bar`
--> <anon>:1:10
|
1 | use std::bar::{foo1, foo2};
| ^^^ Could not find `bar` in `std`
```
instead of:
```rust
error[E0432]: unresolved import `std::bar::foo1`
--> <anon>:1:16
|
1 | use std::bar::{foo1, foo2};
| ^^^^ Could not find `bar` in `std`
error[E0432]: unresolved import `std::bar::foo2`
--> <anon>:1:22
|
1 | use std::bar::{foo1, foo2};
| ^^^^ Could not find `bar` in `std`
```
Fix#43040.
Make the "main" constructors of NonZero/Shared/Unique return Option
Per discussion in https://github.com/rust-lang/rust/issues/27730#issuecomment-303939441.
This is a breaking change to unstable APIs.
The old behavior is still available under the name `new_unchecked`. Note that only that one can be `const fn`, since `if` is currently not allowed in constant contexts.
In the case of `NonZero` this requires adding a new `is_zero` method to the `Zeroable` trait. I mildly dislike this, but it’s not much worse than having a `Zeroable` trait in the first place. `Zeroable` and `NonZero` are both unstable, this can be reworked later.
Point at the correct path segment on a import statement where a module
doesn't exist.
New output:
```rust
error[E0432]: unresolved import `std::bar`
--> <anon>:1:10
|
1 | use std::bar::{foo1, foo2};
| ^^^ Could not find `bar` in `std`
```
instead of:
```rust
error[E0432]: unresolved import `std::bar::foo1`
--> <anon>:1:16
|
1 | use std::bar::{foo1, foo2};
| ^^^^ Could not find `bar` in `std`
error[E0432]: unresolved import `std::bar::foo2`
--> <anon>:1:22
|
1 | use std::bar::{foo1, foo2};
| ^^^^ Could not find `bar` in `std`
```
Add a disabled builder for aarch64 emulated tests
This commit adds a disabled builder which will run all tests for the standard
library for aarch64 in a QEMU instance. Once we get enough capacity to run this
on Travis this can be used to boost our platform coverage of AArch64
bootstrap: Add doctests and unitests
This commit includes the following changes:
* Include more docstrings in classes, methods, and functions
* Add doctests, which are great for self-documenting our source code
* Add some unit tests with the `unittest` module
* Remove `WindowsError` reference on non-windows systems
* Rename some variables to be more explicit about their meaning
* Move all the attributes defined outside of `__init__`
* Add initial support for Python 3
r? @alexcrichton
Bump master to 1.21.0
This commit bumps the master branch's version to 1.21.0 and also updates the
bootstrap compiler from the freshly minted beta release.
This commit includes the following:
* Fix syntax errors in Python 3
* Include more docstrings in classes, methods, and functions
* Include unit tests using `unittest`
* Merge implementation of `{rustc,cargo}_out_of_date`
* Merge implementation of `RustBuild.{cargo,rustc}`
* Remove unnecessary source code
* Move all the attributes defined outside of `__init__`
* Remove remaining `%s` from print function
* Remove `WindowsError` reference on non-windows systems
* Rename some variables to be more explicit avoid their meaning
* Run bootstrap tests in the CI process
* Remove non-pythonic getters
* Remove duplicate code in `download_stage0` method
* Reduce the number of branches in `build_bootstrap` method
* Re-raise exception when we cannot execute uname in non-windows systems
* Avoid long lines
rustbuild: Fix the --build argument to bootstrap.py
This makes the --build argument also apply for the downloading of the stage0 toolchain and building rustbuild.
Fixes#42116
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 commit adds a disabled builder which will run all tests for the standard
library for aarch64 in a QEMU instance. Once we get enough capacity to run this
on Travis this can be used to boost our platform coverage of AArch64
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.