Extended error message for mut borrow conflicts in loops
RFC issue: https://github.com/rust-lang/rfcs/issues/2080
The error message for multiple mutable borrows on the same value over loop iterations now makes it clear that the conflict comes from the borrow outlasting the loop. The wording of the error is based on the special case of the moved-value error for a value moved in a loop. Following the example of that error, the code remains the same for the special case.
This is mainly because I felt the current message is confusing in the loop case : https://github.com/rust-lang/rust/issues/43437. It's not clear that the two conflicting borrows are in different iterations of the loop, and instead it just looks like the compiler has an issue with a single line.
Avoid implying that any copyrights have been assigned to a separate
entity (such as "The Rust Project Developers") Rust contributors retain
their copyrights, and do not assign them to anyone by contributing.
Remove the inaccurate notice, and provide a clear explanation. Avoid
stating that all files contain copyright notices and/or license notices,
and especially avoid suggesting that the license terms only apply to
files marked as such.
In the process, this also drops a separate notice that implies only some
copyrights are retained by contributors (suggesting that others are
not).
LICENSE-MIT contains the line "Copyright (c) 2015 The Rust Project
Developers", which implies that an entity called "The Rust Project
Developers" holds copyrights in Rust. Rust contributors retain
their copyrights, and do not assign them to anyone by contributing.
Remove the inaccurate notice.
Stabilize more APIs for the 1.20.0 release
In addition to the few stabilizations that have already landed, this cleans up the remaining APIs that are in `final-comment-period` right now to be stable by the 1.20.0 release
Make compiletest set cwd before running js tests
Proposed fix for #38800.
Not all tests pass yet - I will mention failures here once the test suite has finished.
This elides initialization for zero-sized arrays:
* for zero-sized elements we previously emitted an empty loop
* for arrays with a length of zero we previously emitted a loop with zero
iterations
This emits llvm.memset() instead of a loop over each element when:
* all elements are zero integers
* elements are byte sized
This is mainly for readability of the generated LLVM IR and subsequently
assembly. There is a slight positive performance impact, likely due to
I-cache effects.
Update RLS
This pulls in 79d659e569 It should fix#43453. It increases the timeout for test runs and forces builds in RLS tests to happen sequentially, this prevents interference between env vars passed to Cargo or rustc.
r? @Mark-Simulacrum
Constrain the layout of Blake2bCtx for proper SPARC compilation
On SPARC, optimization fuel ends up emitting incorrect load and store
instructions for the transmute() call in blake2b_compress(). If we
force Blake2bCtx to be repr(C), the problem disappears.
Fixes#43346
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.
Before this, the diagnostic errors would only point at the return type
when changing it would be a possible solution to a type error. Add a
label to the return type without a suggestion to change in order to make
the source of the expected type obvious.
Follow up to #42850, fixes#25133, fixes#41897.
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
On SPARC, optimization fuel ends up emitting incorrect load and store
instructions for the transmute() call in blake2b_compress(). If we
force Blake2bCtx to be repr(C), the problem disappears.
Fixes#43346
Error message now makes clear that mutable borrow conflicts on a single
value in a loop body is caused by the borrow outlasting a single pass of
the loop.
Loop conflicts are detected by seeing when two borrow locations are the
same - which indicates the same code being run more than once.
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.