summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await/track-caller
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/async-await/track-caller')
-rw-r--r--tests/ui/async-await/track-caller/async-block.afn.stderr30
-rw-r--r--tests/ui/async-await/track-caller/async-block.nofeat.stderr30
-rw-r--r--tests/ui/async-await/track-caller/async-block.rs18
-rw-r--r--tests/ui/async-await/track-caller/async-block.stderr12
-rw-r--r--tests/ui/async-await/track-caller/async-closure-gate.afn.stderr57
-rw-r--r--tests/ui/async-await/track-caller/async-closure-gate.nofeat.stderr57
-rw-r--r--tests/ui/async-await/track-caller/async-closure-gate.rs41
-rw-r--r--tests/ui/async-await/track-caller/async-closure-gate.stderr12
-rw-r--r--tests/ui/async-await/track-caller/panic-track-caller.cls.stderr31
-rw-r--r--tests/ui/async-await/track-caller/panic-track-caller.nofeat.stderr14
-rw-r--r--tests/ui/async-await/track-caller/panic-track-caller.rs46
11 files changed, 299 insertions, 49 deletions
diff --git a/tests/ui/async-await/track-caller/async-block.afn.stderr b/tests/ui/async-await/track-caller/async-block.afn.stderr
new file mode 100644
index 000000000..2302722ee
--- /dev/null
+++ b/tests/ui/async-await/track-caller/async-block.afn.stderr
@@ -0,0 +1,30 @@
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-block.rs:8:13
+ |
+LL | let _ = #[track_caller] async {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-block.rs:15:13
+ |
+LL | let _ = #[track_caller] async {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-block.rs:23:17
+ |
+LL | let _ = #[track_caller] async {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/async-await/track-caller/async-block.nofeat.stderr b/tests/ui/async-await/track-caller/async-block.nofeat.stderr
new file mode 100644
index 000000000..2302722ee
--- /dev/null
+++ b/tests/ui/async-await/track-caller/async-block.nofeat.stderr
@@ -0,0 +1,30 @@
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-block.rs:8:13
+ |
+LL | let _ = #[track_caller] async {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-block.rs:15:13
+ |
+LL | let _ = #[track_caller] async {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-block.rs:23:17
+ |
+LL | let _ = #[track_caller] async {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/async-await/track-caller/async-block.rs b/tests/ui/async-await/track-caller/async-block.rs
index 8ddd4ab11..24711b966 100644
--- a/tests/ui/async-await/track-caller/async-block.rs
+++ b/tests/ui/async-await/track-caller/async-block.rs
@@ -1,9 +1,27 @@
// edition:2021
+// revisions: afn nofeat
#![feature(stmt_expr_attributes)]
+#![cfg_attr(afn, feature(async_fn_track_caller))]
fn main() {
let _ = #[track_caller] async {
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
};
}
+
+#[track_caller]
+async fn foo() {
+ let _ = #[track_caller] async {
+ //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
+ };
+}
+
+#[track_caller]
+async fn foo2() {
+ let _ = async {
+ let _ = #[track_caller] async {
+ //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
+ };
+ };
+}
diff --git a/tests/ui/async-await/track-caller/async-block.stderr b/tests/ui/async-await/track-caller/async-block.stderr
deleted file mode 100644
index 21d1054d2..000000000
--- a/tests/ui/async-await/track-caller/async-block.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0658]: `#[track_caller]` on closures is currently unstable
- --> $DIR/async-block.rs:6:13
- |
-LL | let _ = #[track_caller] async {
- | ^^^^^^^^^^^^^^^
- |
- = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
- = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/async-await/track-caller/async-closure-gate.afn.stderr b/tests/ui/async-await/track-caller/async-closure-gate.afn.stderr
new file mode 100644
index 000000000..739c04a76
--- /dev/null
+++ b/tests/ui/async-await/track-caller/async-closure-gate.afn.stderr
@@ -0,0 +1,57 @@
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:8:13
+ |
+LL | let _ = #[track_caller] async || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:15:13
+ |
+LL | let _ = #[track_caller] async || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:21:13
+ |
+LL | let _ = #[track_caller] || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:28:17
+ |
+LL | let _ = #[track_caller] || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:36:9
+ |
+LL | #[track_caller] || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:45:13
+ |
+LL | #[track_caller] || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/async-await/track-caller/async-closure-gate.nofeat.stderr b/tests/ui/async-await/track-caller/async-closure-gate.nofeat.stderr
new file mode 100644
index 000000000..739c04a76
--- /dev/null
+++ b/tests/ui/async-await/track-caller/async-closure-gate.nofeat.stderr
@@ -0,0 +1,57 @@
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:8:13
+ |
+LL | let _ = #[track_caller] async || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:15:13
+ |
+LL | let _ = #[track_caller] async || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:21:13
+ |
+LL | let _ = #[track_caller] || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:28:17
+ |
+LL | let _ = #[track_caller] || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:36:9
+ |
+LL | #[track_caller] || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/async-closure-gate.rs:45:13
+ |
+LL | #[track_caller] || {
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/async-await/track-caller/async-closure-gate.rs b/tests/ui/async-await/track-caller/async-closure-gate.rs
index d9d556855..8d8d081aa 100644
--- a/tests/ui/async-await/track-caller/async-closure-gate.rs
+++ b/tests/ui/async-await/track-caller/async-closure-gate.rs
@@ -1,9 +1,50 @@
// edition:2021
+// revisions: afn nofeat
#![feature(async_closure, stmt_expr_attributes)]
+#![cfg_attr(afn, feature(async_fn_track_caller))]
fn main() {
let _ = #[track_caller] async || {
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
};
}
+
+#[track_caller]
+async fn foo() {
+ let _ = #[track_caller] async || {
+ //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
+ };
+}
+
+async fn foo2() {
+ let _ = #[track_caller] || {
+ //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
+ };
+}
+
+fn foo3() {
+ async {
+ let _ = #[track_caller] || {
+ //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
+ };
+ }
+}
+
+async fn foo4() {
+ let _ = || {
+ #[track_caller] || {
+ //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
+ };
+ };
+}
+
+fn foo5() {
+ async {
+ let _ = || {
+ #[track_caller] || {
+ //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
+ };
+ };
+ }
+}
diff --git a/tests/ui/async-await/track-caller/async-closure-gate.stderr b/tests/ui/async-await/track-caller/async-closure-gate.stderr
deleted file mode 100644
index 498f1b43b..000000000
--- a/tests/ui/async-await/track-caller/async-closure-gate.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0658]: `#[track_caller]` on closures is currently unstable
- --> $DIR/async-closure-gate.rs:6:13
- |
-LL | let _ = #[track_caller] async || {
- | ^^^^^^^^^^^^^^^
- |
- = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
- = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/async-await/track-caller/panic-track-caller.cls.stderr b/tests/ui/async-await/track-caller/panic-track-caller.cls.stderr
new file mode 100644
index 000000000..f3090e3b9
--- /dev/null
+++ b/tests/ui/async-await/track-caller/panic-track-caller.cls.stderr
@@ -0,0 +1,31 @@
+warning: `#[track_caller]` on async functions is a no-op
+ --> $DIR/panic-track-caller.rs:53:1
+ |
+LL | #[track_caller]
+ | ^^^^^^^^^^^^^^^
+...
+LL | / async fn bar_track_caller() {
+LL | | panic!()
+LL | | }
+ | |_- this function will not propagate the caller location
+ |
+ = note: see issue #110011 <https://github.com/rust-lang/rust/issues/110011> for more information
+ = help: add `#![feature(async_fn_track_caller)]` to the crate attributes to enable
+ = note: `#[warn(ungated_async_fn_track_caller)]` on by default
+
+warning: `#[track_caller]` on async functions is a no-op
+ --> $DIR/panic-track-caller.rs:67:5
+ |
+LL | #[track_caller]
+ | ^^^^^^^^^^^^^^^
+...
+LL | / async fn bar_assoc() {
+LL | | panic!();
+LL | | }
+ | |_____- this function will not propagate the caller location
+ |
+ = note: see issue #110011 <https://github.com/rust-lang/rust/issues/110011> for more information
+ = help: add `#![feature(async_fn_track_caller)]` to the crate attributes to enable
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/async-await/track-caller/panic-track-caller.nofeat.stderr b/tests/ui/async-await/track-caller/panic-track-caller.nofeat.stderr
index 51ea225f4..f3090e3b9 100644
--- a/tests/ui/async-await/track-caller/panic-track-caller.nofeat.stderr
+++ b/tests/ui/async-await/track-caller/panic-track-caller.nofeat.stderr
@@ -1,29 +1,31 @@
warning: `#[track_caller]` on async functions is a no-op
- --> $DIR/panic-track-caller.rs:50:1
+ --> $DIR/panic-track-caller.rs:53:1
|
LL | #[track_caller]
| ^^^^^^^^^^^^^^^
+...
LL | / async fn bar_track_caller() {
LL | | panic!()
LL | | }
| |_- this function will not propagate the caller location
|
- = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
- = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+ = note: see issue #110011 <https://github.com/rust-lang/rust/issues/110011> for more information
+ = help: add `#![feature(async_fn_track_caller)]` to the crate attributes to enable
= note: `#[warn(ungated_async_fn_track_caller)]` on by default
warning: `#[track_caller]` on async functions is a no-op
- --> $DIR/panic-track-caller.rs:62:5
+ --> $DIR/panic-track-caller.rs:67:5
|
LL | #[track_caller]
| ^^^^^^^^^^^^^^^
+...
LL | / async fn bar_assoc() {
LL | | panic!();
LL | | }
| |_____- this function will not propagate the caller location
|
- = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
- = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+ = note: see issue #110011 <https://github.com/rust-lang/rust/issues/110011> for more information
+ = help: add `#![feature(async_fn_track_caller)]` to the crate attributes to enable
warning: 2 warnings emitted
diff --git a/tests/ui/async-await/track-caller/panic-track-caller.rs b/tests/ui/async-await/track-caller/panic-track-caller.rs
index 65bb23e0b..df8290e5f 100644
--- a/tests/ui/async-await/track-caller/panic-track-caller.rs
+++ b/tests/ui/async-await/track-caller/panic-track-caller.rs
@@ -1,9 +1,12 @@
// run-pass
// edition:2021
-// revisions: feat nofeat
+// revisions: afn cls nofeat
// needs-unwind
+// gate-test-async_fn_track_caller
#![feature(async_closure, stmt_expr_attributes)]
-#![cfg_attr(feat, feature(closure_track_caller))]
+#![cfg_attr(afn, feature(async_fn_track_caller))]
+#![cfg_attr(cls, feature(closure_track_caller))]
+#![allow(unused)]
use std::future::Future;
use std::panic;
@@ -47,7 +50,9 @@ async fn foo() {
bar().await
}
-#[track_caller] //[nofeat]~ WARN `#[track_caller]` on async functions is a no-op
+#[track_caller]
+//[cls]~^ WARN `#[track_caller]` on async functions is a no-op
+//[nofeat]~^^ WARN `#[track_caller]` on async functions is a no-op
async fn bar_track_caller() {
panic!()
}
@@ -59,7 +64,9 @@ async fn foo_track_caller() {
struct Foo;
impl Foo {
- #[track_caller] //[nofeat]~ WARN `#[track_caller]` on async functions is a no-op
+ #[track_caller]
+ //[cls]~^ WARN `#[track_caller]` on async functions is a no-op
+ //[nofeat]~^^ WARN `#[track_caller]` on async functions is a no-op
async fn bar_assoc() {
panic!();
}
@@ -71,7 +78,7 @@ async fn foo_assoc() {
// Since compilation is expected to fail for this fn when using
// `nofeat`, we test that separately in `async-closure-gate.rs`
-#[cfg(feat)]
+#[cfg(cls)]
async fn foo_closure() {
let c = #[track_caller] async || {
panic!();
@@ -81,7 +88,7 @@ async fn foo_closure() {
// Since compilation is expected to fail for this fn when using
// `nofeat`, we test that separately in `async-block.rs`
-#[cfg(feat)]
+#[cfg(cls)]
async fn foo_block() {
let a = #[track_caller] async {
panic!();
@@ -106,21 +113,22 @@ fn panicked_at(f: impl FnOnce() + panic::UnwindSafe) -> u32 {
}
fn main() {
- assert_eq!(panicked_at(|| block_on(foo())), 43);
+ assert_eq!(panicked_at(|| block_on(foo())), 46
+);
- #[cfg(feat)]
- assert_eq!(panicked_at(|| block_on(foo_track_caller())), 56);
- #[cfg(nofeat)]
- assert_eq!(panicked_at(|| block_on(foo_track_caller())), 52);
+ #[cfg(afn)]
+ assert_eq!(panicked_at(|| block_on(foo_track_caller())), 61);
+ #[cfg(any(cls, nofeat))]
+ assert_eq!(panicked_at(|| block_on(foo_track_caller())), 57);
- #[cfg(feat)]
- assert_eq!(panicked_at(|| block_on(foo_assoc())), 69);
- #[cfg(nofeat)]
- assert_eq!(panicked_at(|| block_on(foo_assoc())), 64);
+ #[cfg(afn)]
+ assert_eq!(panicked_at(|| block_on(foo_assoc())), 76);
+ #[cfg(any(cls, nofeat))]
+ assert_eq!(panicked_at(|| block_on(foo_assoc())), 71);
- #[cfg(feat)]
- assert_eq!(panicked_at(|| block_on(foo_closure())), 79);
+ #[cfg(cls)]
+ assert_eq!(panicked_at(|| block_on(foo_closure())), 84);
- #[cfg(feat)]
- assert_eq!(panicked_at(|| block_on(foo_block())), 89);
+ #[cfg(cls)]
+ assert_eq!(panicked_at(|| block_on(foo_block())), 96);
}