forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
730a61e
commit 8021573
Showing
12 changed files
with
126 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#![feature(capture_disjoint_fields)] | ||
//~^ WARNING: the feature `capture_disjoint_fields` is incomplete | ||
|
||
// Ensure that diagnostics for mutability error (because the root variable | ||
// isn't mutable) work with `capture_disjoint_fields` enabled. | ||
|
||
fn main() { | ||
let x = (10, 10); | ||
let y = (x, 10); | ||
let z = (y, 10); | ||
|
||
let mut c = || { | ||
z.0.0.0 = 20; | ||
//~^ ERROR: cannot assign to `z`, as it is not declared as mutable | ||
}; | ||
|
||
c(); | ||
} |
21 changes: 21 additions & 0 deletions
21
src/test/ui/closures/2229_closure_analysis/diagnostics/cant-mutate-imm.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
warning: the feature `capture_disjoint_fields` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/cant-mutate-imm.rs:1:12 | ||
| | ||
LL | #![feature(capture_disjoint_fields)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[warn(incomplete_features)]` on by default | ||
= note: see issue #53488 </~https://github.com/rust-lang/rust/issues/53488> for more information | ||
|
||
error[E0594]: cannot assign to `z`, as it is not declared as mutable | ||
--> $DIR/cant-mutate-imm.rs:13:9 | ||
| | ||
LL | let z = (y, 10); | ||
| - help: consider changing this to be mutable: `mut z` | ||
... | ||
LL | z.0.0.0 = 20; | ||
| ^^^^^^^^^^^^ cannot assign | ||
|
||
error: aborting due to previous error; 1 warning emitted | ||
|
||
For more information about this error, try `rustc --explain E0594`. |