diff options
Diffstat (limited to 'src/tools/miri/tests/pass/track-caller-attribute.rs')
| -rw-r--r-- | src/tools/miri/tests/pass/track-caller-attribute.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/tools/miri/tests/pass/track-caller-attribute.rs b/src/tools/miri/tests/pass/track-caller-attribute.rs index bf59617d80f..d88bcc98858 100644 --- a/src/tools/miri/tests/pass/track-caller-attribute.rs +++ b/src/tools/miri/tests/pass/track-caller-attribute.rs @@ -1,8 +1,8 @@ #![feature(core_intrinsics)] #![feature(stmt_expr_attributes)] #![feature(closure_track_caller)] -#![feature(generator_trait)] -#![feature(generators)] +#![feature(coroutine_trait)] +#![feature(coroutines)] use std::ops::{Coroutine, CoroutineState}; use std::panic::Location; @@ -210,9 +210,9 @@ fn test_closure() { assert_eq!(non_tracked_loc.column(), 33); } -fn test_generator() { +fn test_coroutine() { #[track_caller] - fn mono_generator<F: Coroutine<String, Yield = (&'static str, String, Loc), Return = ()>>( + fn mono_coroutine<F: Coroutine<String, Yield = (&'static str, String, Loc), Return = ()>>( val: Pin<&mut F>, ) -> (&'static str, String, Loc) { match val.resume("Mono".to_string()) { @@ -222,7 +222,7 @@ fn test_generator() { } #[track_caller] - fn dyn_generator( + fn dyn_coroutine( val: Pin<&mut dyn Coroutine<String, Yield = (&'static str, String, Loc), Return = ()>>, ) -> (&'static str, String, Loc) { match val.resume("Dyn".to_string()) { @@ -232,32 +232,32 @@ fn test_generator() { } #[rustfmt::skip] - let generator = #[track_caller] |arg: String| { + let coroutine = #[track_caller] |arg: String| { yield ("first", arg.clone(), Location::caller()); yield ("second", arg.clone(), Location::caller()); }; - let mut pinned = Box::pin(generator); - let (dyn_ret, dyn_arg, dyn_loc) = dyn_generator(pinned.as_mut()); + let mut pinned = Box::pin(coroutine); + let (dyn_ret, dyn_arg, dyn_loc) = dyn_coroutine(pinned.as_mut()); assert_eq!(dyn_ret, "first"); assert_eq!(dyn_arg, "Dyn".to_string()); // The `Coroutine` trait does not have `#[track_caller]` on `resume`, so // this will not match. assert_ne!(dyn_loc.file(), file!()); - let (mono_ret, mono_arg, mono_loc) = mono_generator(pinned.as_mut()); + let (mono_ret, mono_arg, mono_loc) = mono_coroutine(pinned.as_mut()); let mono_line = line!() - 1; assert_eq!(mono_ret, "second"); - // The generator ignores the argument to the second `resume` call + // The coroutine ignores the argument to the second `resume` call assert_eq!(mono_arg, "Dyn".to_string()); assert_eq!(mono_loc.file(), file!()); assert_eq!(mono_loc.line(), mono_line); assert_eq!(mono_loc.column(), 42); #[rustfmt::skip] - let non_tracked_generator = || { yield Location::caller(); }; - let non_tracked_line = line!() - 1; // This is the line of the generator, not its caller - let non_tracked_loc = match Box::pin(non_tracked_generator).as_mut().resume(()) { + let non_tracked_coroutine = || { yield Location::caller(); }; + let non_tracked_line = line!() - 1; // This is the line of the coroutine, not its caller + let non_tracked_loc = match Box::pin(non_tracked_coroutine).as_mut().resume(()) { CoroutineState::Yielded(val) => val, _ => unreachable!(), }; @@ -272,5 +272,5 @@ fn main() { test_trait_obj(); test_trait_obj2(); test_closure(); - test_generator(); + test_coroutine(); } |
