Skip to content

Commit

Permalink
Update track_caller tests; run fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
bryangarza committed Dec 21, 2022
1 parent 9650a41 commit ccbba0a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 20 deletions.
7 changes: 2 additions & 5 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/async-await/track-caller/async-closure-gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
};
}
15 changes: 1 addition & 14 deletions src/test/ui/async-await/track-caller/async-closure-gate.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
6 changes: 6 additions & 0 deletions src/test/ui/async-await/track-caller/panic-track-caller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!();
Expand Down Expand Up @@ -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);
}

0 comments on commit ccbba0a

Please sign in to comment.