-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #117134 - lcnr:dropck_outlives-coroutine, r=compiler-er…
…rors dropck_outlives check whether generator witness needs_drop see https://rust-lang.zulipchat.com/#narrow/stream/326866-t-types.2Fnominated/topic/.23116242.3A.20Code.20no.20longer.20compiles.20after.20-Zdrop-tracking-mir.20.E2.80.A6/near/398311627 for an explanation. Fixes #116242 (or well, the repro by `@jamuraa` in #116242 (comment)). I did not add a regression test as it depends on other crates. We do have 1 test going from fail to pass, showing the intended behavior. r? types
- Loading branch information
Showing
11 changed files
with
110 additions
and
59 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
2 changes: 1 addition & 1 deletion
2
tests/ui/coroutine/issue-110929-coroutine-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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
// edition:2021 | ||
// check-pass | ||
#![feature(coroutines)] | ||
|
||
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: 0 additions & 18 deletions
18
tests/ui/coroutine/issue-110929-coroutine-conflict-error-ice.stderr
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// check-pass | ||
// edition: 2021 | ||
|
||
// regression test for #116242. | ||
use std::future; | ||
|
||
fn main() { | ||
let mut recv = future::ready(()); | ||
let _combined_fut = async { | ||
let _ = || read(&mut recv); | ||
}; | ||
|
||
drop(recv); | ||
} | ||
|
||
fn read<F: future::Future>(_: &mut F) -> F::Output { | ||
todo!() | ||
} |
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,23 @@ | ||
// check-pass | ||
// edition: 2021 | ||
|
||
// regression test found while working on #117134. | ||
use std::future; | ||
|
||
fn main() { | ||
let mut recv = future::ready(()); | ||
let _combined_fut = async { | ||
let _ = || read(&mut recv); | ||
}; | ||
|
||
let _uwu = (String::new(), _combined_fut); | ||
// Dropping a coroutine as part of a more complex | ||
// types should not add unnecessary liveness | ||
// constraints. | ||
|
||
drop(recv); | ||
} | ||
|
||
fn read<F: future::Future>(_: &mut F) -> F::Output { | ||
todo!() | ||
} |