-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Don't stop evaluating due to errors before borrow checking #60125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,15 @@ fn foo() -> isize { | |
match x { | ||
Enum::A(_) if { x = Enum::B(false); false } => 1, | ||
//~^ ERROR cannot assign in a pattern guard | ||
//~| WARN cannot assign `x` in match guard | ||
//~| WARN this error has been downgraded to a warning for backwards compatibility | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as a next step we should make this a deny-by-default lint. |
||
//~| WARN this represents potential undefined behavior in your code and this warning will | ||
Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1, | ||
//~^ ERROR cannot mutably borrow in a pattern guard | ||
//~^^ ERROR cannot assign in a pattern guard | ||
//~| ERROR cannot assign in a pattern guard | ||
//~| WARN cannot mutably borrow `x` in match guard | ||
//~| WARN this error has been downgraded to a warning for backwards compatibility | ||
//~| WARN this represents potential undefined behavior in your code and this warning will | ||
Enum::A(p) => *p, | ||
Enum::B(_) => 2, | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
fn main() {} | ||
|
||
const fn slice([a, b]: &[i32]) -> i32 { //~ ERROR refutable pattern in function argument | ||
a + b | ||
a + b //~ ERROR can only call other `const fn` within a `const fn` | ||
//~^ WARN use of possibly uninitialized variable: `a` | ||
//~| WARN this error has been downgraded to a warning for backwards compatibility | ||
//~| WARN this represents potential undefined behavior in your code and this warning will | ||
//~| WARN use of possibly uninitialized variable: `b` | ||
//~| WARN this error has been downgraded to a warning for backwards compatibility | ||
//~| WARN this represents potential undefined behavior in your code and this warning will | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
error[E0004]: non-exhaustive patterns: `&S` not covered | ||
--> $DIR/match_ice.rs:7:11 | ||
error: to use a constant of type `S` in a pattern, `S` must be annotated with `#[derive(PartialEq, Eq)]` | ||
--> $DIR/match_ice.rs:11:9 | ||
| | ||
LL | match C { | ||
| ^ pattern `&S` not covered | ||
LL | C => {} | ||
| ^ | ||
|
||
error[E0004]: non-exhaustive patterns: `&T` not covered | ||
--> $DIR/match_ice.rs:15:11 | ||
| | ||
LL | match K { | ||
| ^ pattern `&T` not covered | ||
| | ||
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms | ||
|
||
error: aborting due to previous error | ||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0004`. |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ fn main() { | |
op_string @ Some(s) => {}, | ||
//~^ ERROR E0007 | ||
//~| ERROR E0303 | ||
//~| ERROR E0382 | ||
None => {}, | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
const A: i32 = B; //~ ERROR cycle detected | ||
//~^ ERROR cycle detected | ||
|
||
const B: i32 = A; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,21 @@ LL | for (n, mut m) in &tups { | |
| | | ||
| both by-ref and by-move used | ||
|
||
error: aborting due to previous error | ||
error[E0507]: cannot move out of borrowed content | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this diagnostic is actually better than the first one. |
||
--> $DIR/for.rs:6:23 | ||
| | ||
LL | for (n, mut m) in &tups { | ||
| ----- ^^^^^ cannot move out of borrowed content | ||
| | | ||
| data moved here | ||
| | ||
note: move occurs because `m` has type `Foo`, which does not implement the `Copy` trait | ||
--> $DIR/for.rs:6:13 | ||
| | ||
LL | for (n, mut m) in &tups { | ||
| ^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0009`. | ||
Some errors have detailed explanations: E0009, E0507. | ||
For more information about an error, try `rustc --explain E0009`. |
Uh oh!
There was an error while loading. Please reload this page.