-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #110957 - WaffleLapkin:reach_generator_conflict_error…
…, r=cjgillot Fix an ICE in conflict error diagnostics Fixes #110929 r? ``@cjgillot``
- Loading branch information
Showing
3 changed files
with
31 additions
and
1 deletion.
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
12 changes: 12 additions & 0 deletions
12
tests/ui/generator/issue-110929-generator-conflict-error-ice.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,12 @@ | ||
// edition:2021 | ||
// compile-flags: -Zdrop-tracking-mir=yes | ||
#![feature(generators)] | ||
|
||
fn main() { | ||
let x = &mut (); | ||
|| { | ||
let _c = || yield *&mut *x; | ||
|| _ = &mut *x; | ||
//~^ cannot borrow `*x` as mutable more than once at a time | ||
}; | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/ui/generator/issue-110929-generator-conflict-error-ice.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,18 @@ | ||
error[E0499]: cannot borrow `*x` as mutable more than once at a time | ||
--> $DIR/issue-110929-generator-conflict-error-ice.rs:9:9 | ||
| | ||
LL | let _c = || yield *&mut *x; | ||
| -- -- first borrow occurs due to use of `*x` in generator | ||
| | | ||
| first mutable borrow occurs here | ||
LL | || _ = &mut *x; | ||
| ^^ -- second borrow occurs due to use of `*x` in closure | ||
| | | ||
| second mutable borrow occurs here | ||
LL | | ||
LL | }; | ||
| - first borrow might be used here, when `_c` is dropped and runs the destructor for generator | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0499`. |