about summary refs log tree commit diff
path: root/src/tools/miri/tests
diff options
context:
space:
mode:
authorThe Miri Cronjob Bot <miri@cron.bot>2024-04-25 05:04:32 +0000
committerThe Miri Cronjob Bot <miri@cron.bot>2024-04-25 05:04:32 +0000
commitff6fc757815055923e7f7ff73eaed8f9cbcfba75 (patch)
treebfd3766e077a0f447004b74063ad40ec02cd00e3 /src/tools/miri/tests
parentbed7caf20638dde1822553d432f6fe213baf4eae (diff)
parentcb3752d20e0f5d24348062211102a08d46fbecff (diff)
downloadrust-ff6fc757815055923e7f7ff73eaed8f9cbcfba75.tar.gz
rust-ff6fc757815055923e7f7ff73eaed8f9cbcfba75.zip
Merge from rustc
Diffstat (limited to 'src/tools/miri/tests')
-rw-r--r--src/tools/miri/tests/fail/coroutine-pinned-moved.rs4
-rw-r--r--src/tools/miri/tests/pass/coroutine.rs36
-rw-r--r--src/tools/miri/tests/pass/portable-simd.rs2
-rw-r--r--src/tools/miri/tests/pass/shims/path.rs1
-rw-r--r--src/tools/miri/tests/pass/stacked-borrows/coroutine-self-referential.rs4
-rw-r--r--src/tools/miri/tests/pass/track-caller-attribute.rs6
6 files changed, 26 insertions, 27 deletions
diff --git a/src/tools/miri/tests/fail/coroutine-pinned-moved.rs b/src/tools/miri/tests/fail/coroutine-pinned-moved.rs
index 005ae7e9132..8648be2a264 100644
--- a/src/tools/miri/tests/fail/coroutine-pinned-moved.rs
+++ b/src/tools/miri/tests/fail/coroutine-pinned-moved.rs
@@ -1,5 +1,5 @@
 //@compile-flags: -Zmiri-disable-validation -Zmiri-disable-stacked-borrows
-#![feature(coroutines, coroutine_trait)]
+#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
 
 use std::{
     ops::{Coroutine, CoroutineState},
@@ -7,7 +7,7 @@ use std::{
 };
 
 fn firstn() -> impl Coroutine<Yield = u64, Return = ()> {
-    static move || {
+    #[coroutine] static move || {
         let mut num = 0;
         let num = &mut num;
         *num += 0;
diff --git a/src/tools/miri/tests/pass/coroutine.rs b/src/tools/miri/tests/pass/coroutine.rs
index 7e1f64df04d..e76abfc4185 100644
--- a/src/tools/miri/tests/pass/coroutine.rs
+++ b/src/tools/miri/tests/pass/coroutine.rs
@@ -1,6 +1,6 @@
 //@revisions: stack tree
 //@[tree]compile-flags: -Zmiri-tree-borrows
-#![feature(coroutines, coroutine_trait, never_type)]
+#![feature(coroutines, coroutine_trait, never_type, stmt_expr_attributes)]
 
 use std::fmt::Debug;
 use std::mem::ManuallyDrop;
@@ -43,9 +43,9 @@ fn basic() {
         panic!()
     }
 
-    finish(1, false, || yield 1);
+    finish(1, false, #[coroutine] || yield 1);
 
-    finish(3, false, || {
+    finish(3, false, #[coroutine] || {
         let mut x = 0;
         yield 1;
         x += 1;
@@ -55,27 +55,27 @@ fn basic() {
         assert_eq!(x, 2);
     });
 
-    finish(7 * 8 / 2, false, || {
+    finish(7 * 8 / 2, false, #[coroutine] || {
         for i in 0..8 {
             yield i;
         }
     });
 
-    finish(1, false, || {
+    finish(1, false, #[coroutine] || {
         if true {
             yield 1;
         } else {
         }
     });
 
-    finish(1, false, || {
+    finish(1, false, #[coroutine] || {
         if false {
         } else {
             yield 1;
         }
     });
 
-    finish(2, false, || {
+    finish(2, false, #[coroutine] || {
         if {
             yield 1;
             false
@@ -88,7 +88,7 @@ fn basic() {
 
     // also test self-referential coroutines
     assert_eq!(
-        finish(5, true, static || {
+        finish(5, true, #[coroutine] static || {
             let mut x = 5;
             let y = &mut x;
             *y = 5;
@@ -99,7 +99,7 @@ fn basic() {
         10
     );
     assert_eq!(
-        finish(5, true, || {
+        finish(5, true, #[coroutine] || {
             let mut x = Box::new(5);
             let y = &mut *x;
             *y = 5;
@@ -111,7 +111,7 @@ fn basic() {
     );
 
     let b = true;
-    finish(1, false, || {
+    finish(1, false, #[coroutine] || {
         yield 1;
         if b {
             return;
@@ -123,7 +123,7 @@ fn basic() {
         drop(x);
     });
 
-    finish(3, false, || {
+    finish(3, false, #[coroutine] || {
         yield 1;
         #[allow(unreachable_code)]
         let _x: (String, !) = (String::new(), {
@@ -172,7 +172,7 @@ fn smoke_resume_arg() {
     }
 
     drain(
-        &mut |mut b| {
+        &mut #[coroutine] |mut b| {
             while b != 0 {
                 b = yield (b + 1);
             }
@@ -181,21 +181,21 @@ fn smoke_resume_arg() {
         vec![(1, Yielded(2)), (-45, Yielded(-44)), (500, Yielded(501)), (0, Complete(-1))],
     );
 
-    expect_drops(2, || drain(&mut |a| yield a, vec![(DropMe, Yielded(DropMe))]));
+    expect_drops(2, || drain(&mut #[coroutine] |a| yield a, vec![(DropMe, Yielded(DropMe))]));
 
     expect_drops(6, || {
         drain(
-            &mut |a| yield yield a,
+            &mut #[coroutine] |a| yield yield a,
             vec![(DropMe, Yielded(DropMe)), (DropMe, Yielded(DropMe)), (DropMe, Complete(DropMe))],
         )
     });
 
     #[allow(unreachable_code)]
-    expect_drops(2, || drain(&mut |a| yield return a, vec![(DropMe, Complete(DropMe))]));
+    expect_drops(2, || drain(&mut #[coroutine] |a| yield return a, vec![(DropMe, Complete(DropMe))]));
 
     expect_drops(2, || {
         drain(
-            &mut |a: DropMe| {
+            &mut #[coroutine] |a: DropMe| {
                 if false { yield () } else { a }
             },
             vec![(DropMe, Complete(DropMe))],
@@ -205,7 +205,7 @@ fn smoke_resume_arg() {
     expect_drops(4, || {
         drain(
             #[allow(unused_assignments, unused_variables)]
-            &mut |mut a: DropMe| {
+            &mut #[coroutine] |mut a: DropMe| {
                 a = yield;
                 a = yield;
                 a = yield;
@@ -228,7 +228,7 @@ fn uninit_fields() {
     }
 
     fn run<T>(x: bool, y: bool) {
-        let mut c = || {
+        let mut c = #[coroutine] || {
             if x {
                 let _a: T;
                 if y {
diff --git a/src/tools/miri/tests/pass/portable-simd.rs b/src/tools/miri/tests/pass/portable-simd.rs
index cdb441b450b..1fc713d48dc 100644
--- a/src/tools/miri/tests/pass/portable-simd.rs
+++ b/src/tools/miri/tests/pass/portable-simd.rs
@@ -1,5 +1,5 @@
 //@compile-flags: -Zmiri-strict-provenance
-#![feature(portable_simd, adt_const_params, inline_const, core_intrinsics)]
+#![feature(portable_simd, adt_const_params, core_intrinsics)]
 #![allow(incomplete_features, internal_features)]
 use std::intrinsics::simd as intrinsics;
 use std::ptr;
diff --git a/src/tools/miri/tests/pass/shims/path.rs b/src/tools/miri/tests/pass/shims/path.rs
index 9fc6e7faefb..cadbeb476bd 100644
--- a/src/tools/miri/tests/pass/shims/path.rs
+++ b/src/tools/miri/tests/pass/shims/path.rs
@@ -1,5 +1,4 @@
 //@compile-flags: -Zmiri-disable-isolation
-#![feature(absolute_path)]
 use std::path::{absolute, Path};
 
 #[track_caller]
diff --git a/src/tools/miri/tests/pass/stacked-borrows/coroutine-self-referential.rs b/src/tools/miri/tests/pass/stacked-borrows/coroutine-self-referential.rs
index c4b15c8758b..bb98e024a0a 100644
--- a/src/tools/miri/tests/pass/stacked-borrows/coroutine-self-referential.rs
+++ b/src/tools/miri/tests/pass/stacked-borrows/coroutine-self-referential.rs
@@ -1,6 +1,6 @@
 // See https://github.com/rust-lang/unsafe-code-guidelines/issues/148:
 // this fails when Stacked Borrows is strictly applied even to `!Unpin` types.
-#![feature(coroutines, coroutine_trait)]
+#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
 
 use std::{
     ops::{Coroutine, CoroutineState},
@@ -8,7 +8,7 @@ use std::{
 };
 
 fn firstn() -> impl Coroutine<Yield = u64, Return = ()> {
-    static move || {
+    #[coroutine] static move || {
         let mut num = 0;
         let num = &mut num;
 
diff --git a/src/tools/miri/tests/pass/track-caller-attribute.rs b/src/tools/miri/tests/pass/track-caller-attribute.rs
index d88bcc98858..c3803af3cc8 100644
--- a/src/tools/miri/tests/pass/track-caller-attribute.rs
+++ b/src/tools/miri/tests/pass/track-caller-attribute.rs
@@ -232,7 +232,7 @@ fn test_coroutine() {
     }
 
     #[rustfmt::skip]
-    let coroutine = #[track_caller] |arg: String| {
+    let coroutine = #[track_caller] #[coroutine] |arg: String| {
         yield ("first", arg.clone(), Location::caller());
         yield ("second", arg.clone(), Location::caller());
     };
@@ -255,7 +255,7 @@ fn test_coroutine() {
     assert_eq!(mono_loc.column(), 42);
 
     #[rustfmt::skip]
-    let non_tracked_coroutine = || { yield Location::caller(); };
+    let non_tracked_coroutine = #[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,
@@ -263,7 +263,7 @@ fn test_coroutine() {
     };
     assert_eq!(non_tracked_loc.file(), file!());
     assert_eq!(non_tracked_loc.line(), non_tracked_line);
-    assert_eq!(non_tracked_loc.column(), 44);
+    assert_eq!(non_tracked_loc.column(), 57);
 }
 
 fn main() {