| Age | Commit message (Collapse) | Author | Lines |
|
Make the spacing between the code snippet and verbose structured
suggestions consistent with note and help messages.
|
|
|
|
Fix most remaining Polonius test differences
This fixes most of the Polonius test differences and also avoids overflow in issue-38591.rs.
r? @nikomatsakis
|
|
This fixes some test differences and also avoids overflow in
issue-38591.rs.
|
|
|
|
|
|
|
|
Error explanation e0524
Part of https://github.com/rust-lang/rust/issues/61137
|
|
|
|
Fix backticks in documentation
Fix a few typos in comments/documentation where backticks were doubled-up on one side.
|
|
|
|
Polonius
|
|
Stabilize `bind_by_move_pattern_guards` in Rust 1.39.0
Closes https://github.com/rust-lang/rust/issues/15287.
After stabilizing `#![feature(bind_by_move_pattern_guards)]`, you can now use bind-by-move bindings in patterns and take references to those bindings in `if` guards of `match` expressions. For example, the following now becomes legal:
```rust
fn main() {
let array: Box<[u8; 4]> = Box::new([1, 2, 3, 4]);
match array {
nums
// ---- `nums` is bound by move.
if nums.iter().sum::<u8>() == 10
// ^------ `.iter()` implicitly takes a reference to `nums`.
=> {
drop(nums);
// --------- Legal as `nums` was bound by move and so we have ownership.
}
_ => unreachable!(),
}
}
```
r? @matthewjasper
|
|
|
|
|
|
Fixed grammar/style in some error messages
Factored out from hacking on rustc for work on the REPL.
r? @Centril
|
|
|
|
|
|
It can return `Err` due to macros being expanded across crates or
files.
|
|
Make use of possibly uninitialized data [E0381] a hard error
This is one of the behaviors we no longer allow in NLL. Since it can
lead to undefined behavior, I think it's definitely worth making it a
hard error without waiting to turn off migration mode (#58781).
Closes #60450.
My ulterior motive here is making it impossible to leave variables
partially initialized across a yield (see #60889, discussion at #63035), so
tests are included for that.
cc #54987
---
I'm not sure if bypassing the buffer is a good way of doing this. We could also make a `force_errors_buffer` or similar that gets recombined with all the errors as they are emitted. But this is simpler and seems fine to me.
r? @Centril
cc @cramertj @nikomatsakis @pnkfelix @RalfJung
|
|
This is one of the behaviors we no longer allow in NLL. Since it can
lead to undefined behavior, I think it's definitely worth making it a
hard error without waiting to turn off migration mode (#58781).
Closes #60450.
My ulterior motive here is making it impossible to leave variables
partially initialized across a yield (see discussion at #63035), so
tests are included for that.
|
|
|
|
|
|
|
|
Avoid ICE when referencing desugared local binding in borrow error
To avoid leaking the names of local bindings from expressions like for loops, #60984 explicitly ignored them, but an assertion that `LocalKind::Var` *must* have a name would trigger an ICE.
Before this change, the binding generated by desugaring the for loop would leak into the diagnostic (#63027):
```
error[E0515]: cannot return value referencing local variable `__next`
--> return-local-binding-from-desugaring.rs:LL:CC
|
LL | for ref x in xs {
| ----- `__next` is borrowed here
...
LL | result
| ^^^^^^ returns a value referencing data owned by the current function
```
Ideally `LocalKind` would carry more information to more accurately explain the problem, but for now, in order to avoid the ICE (fix #63026), we accept `LocalKind::Var` without a name and produce the following output:
```
error[E0515]: cannot return value referencing local binding
--> $DIR/return-local-binding-from-desugaring.rs:30:5
|
LL | for ref x in xs {
| -- local binding introduced here
...
LL | result
| ^^^^^^ returns a value referencing data owned by the current function
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Polonius
|
|
|
|
|
|
This is just a difference from the test construction, it's ignore-compare-mode-nll and manually checks migrate/nll over edition2015/2018.
This failure is because the `migrate2015` and `migrate2018` revisions are ran with `-Zpolonius`. There is no actual difference in the errors output by NLLs and Polonius.
|
|
There is no difference between the NLL and Polonius outputs, and it manually tests NLLs.
|
|
This is test specific to the NLL migrate mode which is irrelevant to -Z polonius.
It can't currently be encoded depending on migrate-mode and NLL/Polonius mode, so the NLL compare-mode also ignores it.
|
|
https://github.com/rust-lang/rust/issues/60532
|
|
Improve diagnostics for invalid mutation through overloaded operators
Closes #58864
Closes #52941
Closes #57839
|
|
Sometimes generate storage statements for temporaries with type `!`
Closes #62165
cc #42371
|
|
Exit arm scopes
Due to a bug in the HIR CFG construction, borrows for arm scopes were incorrectly leaking into other arms.
This PR also includes some drive-by improvements to `-Zunpretty=hir,identified` that would have been helpful while investigating this.
Closes #62107
|
|
|
|
With `feature(never_type)`, it's not guaranteed that any variable with
type `!` isn't ever assigned to.
|
|
When a match evaluates to false we jump to the next arm, when we do so
we need to make sure that we exit the scope for that arm.
|
|
https://github.com/rust-lang/rust/issues/60532
r? @alexreg
|
|
|
|
|
|
|
|
As per issue #54985 removes the not useful suggestion to remove asterisk in
move errors. Includes minor changes to tests in the `ui` suite to account
for the removed suggestion.
|