diff options
Diffstat (limited to '')
-rw-r--r-- | tests/ui/generator/issue-68112.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/ui/generator/issue-68112.rs b/tests/ui/generator/issue-68112.rs index 21026f45c..48b53b769 100644 --- a/tests/ui/generator/issue-68112.rs +++ b/tests/ui/generator/issue-68112.rs @@ -1,3 +1,6 @@ +// revisions: no_drop_tracking drop_tracking drop_tracking_mir +// [drop_tracking] compile-flags: -Zdrop-tracking +// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir #![feature(generators, generator_trait)] use std::{ @@ -8,7 +11,7 @@ use std::{ }; pub struct Ready<T>(Option<T>); -impl<T> Generator<()> for Ready<T> { +impl<T: Unpin> Generator<()> for Ready<T> { type Return = T; type Yield = (); fn resume(mut self: Pin<&mut Self>, _args: ()) -> GeneratorState<(), T> { @@ -36,10 +39,11 @@ fn test1() { yield; //~^ NOTE yield occurs here //~| NOTE value is used across a yield - }; //~ NOTE later dropped here + }; //[no_drop_tracking,drop_tracking]~ NOTE later dropped here require_send(send_gen); //~^ ERROR generator cannot be sent between threads //~| NOTE not `Send` + //~| NOTE use `std::sync::RwLock` instead } pub fn make_gen2<T>(t: T) -> impl Generator<Return = T> { @@ -64,8 +68,9 @@ fn test2() { //~^ ERROR `RefCell<i32>` cannot be shared between threads safely //~| NOTE `RefCell<i32>` cannot be shared between threads safely //~| NOTE required for - //~| NOTE required by a bound introduced by this call + //[no_drop_tracking,drop_tracking]~| NOTE required by a bound introduced by this call //~| NOTE captures the following types + //~| NOTE use `std::sync::RwLock` instead } fn main() {} |