about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBryan Garza <1396101+bryangarza@users.noreply.github.com>2022-12-21 23:22:56 +0000
committerBryan Garza <1396101+bryangarza@users.noreply.github.com>2022-12-21 23:25:08 +0000
commitccbba0a60e3b094aeb48991cac9b6e342eb3e229 (patch)
treecdff0592cb6a06bf77ead60de31113ac983acecb
parent9650a4168f2d5f4edb3338a484ab5c8d1a4b0e52 (diff)
downloadrust-ccbba0a60e3b094aeb48991cac9b6e342eb3e229.tar.gz
rust-ccbba0a60e3b094aeb48991cac9b6e342eb3e229.zip
Update track_caller tests; run fmt
-rw-r--r--compiler/rustc_ast_lowering/src/expr.rs7
-rw-r--r--src/test/ui/async-await/track-caller/async-closure-gate.rs1
-rw-r--r--src/test/ui/async-await/track-caller/async-closure-gate.stderr15
-rw-r--r--src/test/ui/async-await/track-caller/panic-track-caller.rs6
4 files changed, 9 insertions, 20 deletions
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs
index 805050e681b..3634e6e47ce 100644
--- a/compiler/rustc_ast_lowering/src/expr.rs
+++ b/compiler/rustc_ast_lowering/src/expr.rs
@@ -657,11 +657,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
         };
 
         let hir_id = self.lower_node_id(closure_node_id);
-        let unstable_span = self.mark_span_with_reason(
-            DesugaringKind::Async,
-            span,
-            self.allow_gen_future.clone(),
-        );
+        let unstable_span =
+            self.mark_span_with_reason(DesugaringKind::Async, span, self.allow_gen_future.clone());
 
         if self.tcx.features().closure_track_caller
             && let Some(attrs) = self.attrs.get(&outer_hir_id.local_id)
diff --git a/src/test/ui/async-await/track-caller/async-closure-gate.rs b/src/test/ui/async-await/track-caller/async-closure-gate.rs
index 9593fdb1908..d9d55685599 100644
--- a/src/test/ui/async-await/track-caller/async-closure-gate.rs
+++ b/src/test/ui/async-await/track-caller/async-closure-gate.rs
@@ -5,6 +5,5 @@
 fn main() {
     let _ = #[track_caller] async || {
         //~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
-        //~| ERROR `#[track_caller]` on closures is currently unstable [E0658]
     };
 }
diff --git a/src/test/ui/async-await/track-caller/async-closure-gate.stderr b/src/test/ui/async-await/track-caller/async-closure-gate.stderr
index be3d110eccd..498f1b43b9b 100644
--- a/src/test/ui/async-await/track-caller/async-closure-gate.stderr
+++ b/src/test/ui/async-await/track-caller/async-closure-gate.stderr
@@ -7,19 +7,6 @@ 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:6:38
-   |
-LL |       let _ = #[track_caller] async || {
-   |  ______________________________________^
-LL | |
-LL | |
-LL | |     };
-   | |_____^
-   |
-   = 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 2 previous errors
+error: aborting due to previous error
 
 For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/async-await/track-caller/panic-track-caller.rs b/src/test/ui/async-await/track-caller/panic-track-caller.rs
index 02077db7c62..f45243b0ea6 100644
--- a/src/test/ui/async-await/track-caller/panic-track-caller.rs
+++ b/src/test/ui/async-await/track-caller/panic-track-caller.rs
@@ -69,6 +69,9 @@ async fn foo_assoc() {
     Foo::bar_assoc().await
 }
 
+// Since compilation is expected to fail for this fn when using
+// `nofeat`, we test that separately in `async-closure-gate.rs`
+#[cfg(feat)]
 async fn foo_closure() {
     let c = #[track_caller] async || {
         panic!();
@@ -104,4 +107,7 @@ fn main() {
     assert_eq!(panicked_at(|| block_on(foo_assoc())), 69);
     #[cfg(nofeat)]
     assert_eq!(panicked_at(|| block_on(foo_assoc())), 64);
+
+    #[cfg(feat)]
+    assert_eq!(panicked_at(|| block_on(foo_closure())), 79);
 }