Skip to content

Commit e173a8e

Browse files
committedAug 4, 2023
Auto merge of #112117 - bryangarza:track-caller-feature-gate, r=compiler-errors
Add separate feature gate for async fn track caller This patch adds a feature gate `async_fn_track_caller` that is separate from `closure_track_caller`. This is to allow enabling `async_fn_track_caller` separately. Fixes #110009
2 parents e4c1446 + 673ab17 commit e173a8e

20 files changed

+326
-63
lines changed
 

‎compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,14 +657,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
657657
}
658658

659659
/// Forwards a possible `#[track_caller]` annotation from `outer_hir_id` to
660-
/// `inner_hir_id` in case the `closure_track_caller` feature is enabled.
660+
/// `inner_hir_id` in case the `async_fn_track_caller` feature is enabled.
661661
pub(super) fn maybe_forward_track_caller(
662662
&mut self,
663663
span: Span,
664664
outer_hir_id: hir::HirId,
665665
inner_hir_id: hir::HirId,
666666
) {
667-
if self.tcx.features().closure_track_caller
667+
if self.tcx.features().async_fn_track_caller
668668
&& let Some(attrs) = self.attrs.get(&outer_hir_id.local_id)
669669
&& attrs.into_iter().any(|attr| attr.has_name(sym::track_caller))
670670
{

‎compiler/rustc_ast_lowering/src/item.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ impl<'a, 'hir> ItemLowerer<'a, 'hir> {
5656
owner: NodeId,
5757
f: impl FnOnce(&mut LoweringContext<'_, 'hir>) -> hir::OwnerNode<'hir>,
5858
) {
59+
let allow_gen_future = Some(if self.tcx.features().async_fn_track_caller {
60+
[sym::gen_future, sym::closure_track_caller][..].into()
61+
} else {
62+
[sym::gen_future][..].into()
63+
});
5964
let mut lctx = LoweringContext {
6065
// Pseudo-globals.
6166
tcx: self.tcx,
@@ -83,7 +88,7 @@ impl<'a, 'hir> ItemLowerer<'a, 'hir> {
8388
impl_trait_defs: Vec::new(),
8489
impl_trait_bounds: Vec::new(),
8590
allow_try_trait: Some([sym::try_trait_v2, sym::yeet_desugar_details][..].into()),
86-
allow_gen_future: Some([sym::gen_future, sym::closure_track_caller][..].into()),
91+
allow_gen_future,
8792
generics_def_id_map: Default::default(),
8893
};
8994
lctx.with_hir_id_owner(owner, |lctx| f(lctx));

‎compiler/rustc_codegen_ssa/src/codegen_attrs.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,19 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
215215
}
216216
sym::thread_local => codegen_fn_attrs.flags |= CodegenFnAttrFlags::THREAD_LOCAL,
217217
sym::track_caller => {
218-
if !tcx.is_closure(did.to_def_id())
218+
let is_closure = tcx.is_closure(did.to_def_id());
219+
220+
if !is_closure
219221
&& let Some(fn_sig) = fn_sig()
220222
&& fn_sig.skip_binder().abi() != abi::Abi::Rust
221223
{
222224
struct_span_err!(tcx.sess, attr.span, E0737, "`#[track_caller]` requires Rust ABI")
223225
.emit();
224226
}
225-
if tcx.is_closure(did.to_def_id()) && !tcx.features().closure_track_caller {
227+
if is_closure
228+
&& !tcx.features().closure_track_caller
229+
&& !attr.span.allows_unstable(sym::closure_track_caller)
230+
{
226231
feature_err(
227232
&tcx.sess.parse_sess,
228233
sym::closure_track_caller,

‎compiler/rustc_feature/src/active.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ declare_features! (
339339
(active, async_closure, "1.37.0", Some(62290), None),
340340
/// Allows async functions to be declared, implemented, and used in traits.
341341
(active, async_fn_in_trait, "1.66.0", Some(91611), None),
342+
/// Allows `#[track_caller]` on async functions.
343+
(active, async_fn_track_caller, "CURRENT_RUSTC_VERSION", Some(110011), None),
342344
/// Allows builtin # foo() syntax
343345
(active, builtin_syntax, "1.71.0", Some(110680), None),
344346
/// Allows `c"foo"` literals.

‎compiler/rustc_lint/src/builtin.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,8 +1259,8 @@ impl<'tcx> LateLintPass<'tcx> for UnstableFeatures {
12591259

12601260
declare_lint! {
12611261
/// The `ungated_async_fn_track_caller` lint warns when the
1262-
/// `#[track_caller]` attribute is used on an async function, method, or
1263-
/// closure, without enabling the corresponding unstable feature flag.
1262+
/// `#[track_caller]` attribute is used on an async function
1263+
/// without enabling the corresponding unstable feature flag.
12641264
///
12651265
/// ### Example
12661266
///
@@ -1274,13 +1274,13 @@ declare_lint! {
12741274
/// ### Explanation
12751275
///
12761276
/// The attribute must be used in conjunction with the
1277-
/// [`closure_track_caller` feature flag]. Otherwise, the `#[track_caller]`
1277+
/// [`async_fn_track_caller` feature flag]. Otherwise, the `#[track_caller]`
12781278
/// annotation will function as a no-op.
12791279
///
1280-
/// [`closure_track_caller` feature flag]: https://doc.rust-lang.org/beta/unstable-book/language-features/closure-track-caller.html
1280+
/// [`async_fn_track_caller` feature flag]: https://doc.rust-lang.org/beta/unstable-book/language-features/async-fn-track-caller.html
12811281
UNGATED_ASYNC_FN_TRACK_CALLER,
12821282
Warn,
1283-
"enabling track_caller on an async fn is a no-op unless the closure_track_caller feature is enabled"
1283+
"enabling track_caller on an async fn is a no-op unless the async_fn_track_caller feature is enabled"
12841284
}
12851285

12861286
declare_lint_pass!(
@@ -1300,7 +1300,7 @@ impl<'tcx> LateLintPass<'tcx> for UngatedAsyncFnTrackCaller {
13001300
def_id: LocalDefId,
13011301
) {
13021302
if fn_kind.asyncness() == IsAsync::Async
1303-
&& !cx.tcx.features().closure_track_caller
1303+
&& !cx.tcx.features().async_fn_track_caller
13041304
// Now, check if the function has the `#[track_caller]` attribute
13051305
&& let Some(attr) = cx.tcx.get_attr(def_id, sym::track_caller)
13061306
{

‎compiler/rustc_lint/src/lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl<'a> DecorateLint<'a, ()> for BuiltinUngatedAsyncFnTrackCaller<'_> {
250250
rustc_session::parse::add_feature_diagnostics(
251251
diag,
252252
&self.parse_sess,
253-
sym::closure_track_caller,
253+
sym::async_fn_track_caller,
254254
);
255255
diag
256256
}

‎compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ symbols! {
400400
async_await,
401401
async_closure,
402402
async_fn_in_trait,
403+
async_fn_track_caller,
403404
atomic,
404405
atomic_mod,
405406
atomics,
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
error[E0658]: `#[track_caller]` on closures is currently unstable
2+
--> $DIR/async-block.rs:8:13
3+
|
4+
LL | let _ = #[track_caller] async {
5+
| ^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
8+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
9+
10+
error[E0658]: `#[track_caller]` on closures is currently unstable
11+
--> $DIR/async-block.rs:15:13
12+
|
13+
LL | let _ = #[track_caller] async {
14+
| ^^^^^^^^^^^^^^^
15+
|
16+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
17+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
18+
19+
error[E0658]: `#[track_caller]` on closures is currently unstable
20+
--> $DIR/async-block.rs:23:17
21+
|
22+
LL | let _ = #[track_caller] async {
23+
| ^^^^^^^^^^^^^^^
24+
|
25+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
26+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
27+
28+
error: aborting due to 3 previous errors
29+
30+
For more information about this error, try `rustc --explain E0658`.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
error[E0658]: `#[track_caller]` on closures is currently unstable
2+
--> $DIR/async-block.rs:8:13
3+
|
4+
LL | let _ = #[track_caller] async {
5+
| ^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
8+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
9+
10+
error[E0658]: `#[track_caller]` on closures is currently unstable
11+
--> $DIR/async-block.rs:15:13
12+
|
13+
LL | let _ = #[track_caller] async {
14+
| ^^^^^^^^^^^^^^^
15+
|
16+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
17+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
18+
19+
error[E0658]: `#[track_caller]` on closures is currently unstable
20+
--> $DIR/async-block.rs:23:17
21+
|
22+
LL | let _ = #[track_caller] async {
23+
| ^^^^^^^^^^^^^^^
24+
|
25+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
26+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
27+
28+
error: aborting due to 3 previous errors
29+
30+
For more information about this error, try `rustc --explain E0658`.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
// edition:2021
2+
// revisions: afn nofeat
23

34
#![feature(stmt_expr_attributes)]
5+
#![cfg_attr(afn, feature(async_fn_track_caller))]
46

57
fn main() {
68
let _ = #[track_caller] async {
79
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
810
};
911
}
12+
13+
#[track_caller]
14+
async fn foo() {
15+
let _ = #[track_caller] async {
16+
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
17+
};
18+
}
19+
20+
#[track_caller]
21+
async fn foo2() {
22+
let _ = async {
23+
let _ = #[track_caller] async {
24+
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
25+
};
26+
};
27+
}

‎tests/ui/async-await/track-caller/async-block.stderr

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
error[E0658]: `#[track_caller]` on closures is currently unstable
2+
--> $DIR/async-closure-gate.rs:8:13
3+
|
4+
LL | let _ = #[track_caller] async || {
5+
| ^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
8+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
9+
10+
error[E0658]: `#[track_caller]` on closures is currently unstable
11+
--> $DIR/async-closure-gate.rs:15:13
12+
|
13+
LL | let _ = #[track_caller] async || {
14+
| ^^^^^^^^^^^^^^^
15+
|
16+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
17+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
18+
19+
error[E0658]: `#[track_caller]` on closures is currently unstable
20+
--> $DIR/async-closure-gate.rs:21:13
21+
|
22+
LL | let _ = #[track_caller] || {
23+
| ^^^^^^^^^^^^^^^
24+
|
25+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
26+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
27+
28+
error[E0658]: `#[track_caller]` on closures is currently unstable
29+
--> $DIR/async-closure-gate.rs:28:17
30+
|
31+
LL | let _ = #[track_caller] || {
32+
| ^^^^^^^^^^^^^^^
33+
|
34+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
35+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
36+
37+
error[E0658]: `#[track_caller]` on closures is currently unstable
38+
--> $DIR/async-closure-gate.rs:36:9
39+
|
40+
LL | #[track_caller] || {
41+
| ^^^^^^^^^^^^^^^
42+
|
43+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
44+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
45+
46+
error[E0658]: `#[track_caller]` on closures is currently unstable
47+
--> $DIR/async-closure-gate.rs:45:13
48+
|
49+
LL | #[track_caller] || {
50+
| ^^^^^^^^^^^^^^^
51+
|
52+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
53+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
54+
55+
error: aborting due to 6 previous errors
56+
57+
For more information about this error, try `rustc --explain E0658`.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
error[E0658]: `#[track_caller]` on closures is currently unstable
2+
--> $DIR/async-closure-gate.rs:8:13
3+
|
4+
LL | let _ = #[track_caller] async || {
5+
| ^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
8+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
9+
10+
error[E0658]: `#[track_caller]` on closures is currently unstable
11+
--> $DIR/async-closure-gate.rs:15:13
12+
|
13+
LL | let _ = #[track_caller] async || {
14+
| ^^^^^^^^^^^^^^^
15+
|
16+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
17+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
18+
19+
error[E0658]: `#[track_caller]` on closures is currently unstable
20+
--> $DIR/async-closure-gate.rs:21:13
21+
|
22+
LL | let _ = #[track_caller] || {
23+
| ^^^^^^^^^^^^^^^
24+
|
25+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
26+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
27+
28+
error[E0658]: `#[track_caller]` on closures is currently unstable
29+
--> $DIR/async-closure-gate.rs:28:17
30+
|
31+
LL | let _ = #[track_caller] || {
32+
| ^^^^^^^^^^^^^^^
33+
|
34+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
35+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
36+
37+
error[E0658]: `#[track_caller]` on closures is currently unstable
38+
--> $DIR/async-closure-gate.rs:36:9
39+
|
40+
LL | #[track_caller] || {
41+
| ^^^^^^^^^^^^^^^
42+
|
43+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
44+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
45+
46+
error[E0658]: `#[track_caller]` on closures is currently unstable
47+
--> $DIR/async-closure-gate.rs:45:13
48+
|
49+
LL | #[track_caller] || {
50+
| ^^^^^^^^^^^^^^^
51+
|
52+
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
53+
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
54+
55+
error: aborting due to 6 previous errors
56+
57+
For more information about this error, try `rustc --explain E0658`.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,50 @@
11
// edition:2021
2+
// revisions: afn nofeat
23

34
#![feature(async_closure, stmt_expr_attributes)]
5+
#![cfg_attr(afn, feature(async_fn_track_caller))]
46

57
fn main() {
68
let _ = #[track_caller] async || {
79
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
810
};
911
}
12+
13+
#[track_caller]
14+
async fn foo() {
15+
let _ = #[track_caller] async || {
16+
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
17+
};
18+
}
19+
20+
async fn foo2() {
21+
let _ = #[track_caller] || {
22+
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
23+
};
24+
}
25+
26+
fn foo3() {
27+
async {
28+
let _ = #[track_caller] || {
29+
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
30+
};
31+
}
32+
}
33+
34+
async fn foo4() {
35+
let _ = || {
36+
#[track_caller] || {
37+
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
38+
};
39+
};
40+
}
41+
42+
fn foo5() {
43+
async {
44+
let _ = || {
45+
#[track_caller] || {
46+
//~^ ERROR `#[track_caller]` on closures is currently unstable [E0658]
47+
};
48+
};
49+
}
50+
}

‎tests/ui/async-await/track-caller/async-closure-gate.stderr

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
warning: `#[track_caller]` on async functions is a no-op
2+
--> $DIR/panic-track-caller.rs:53:1
3+
|
4+
LL | #[track_caller]
5+
| ^^^^^^^^^^^^^^^
6+
...
7+
LL | / async fn bar_track_caller() {
8+
LL | | panic!()
9+
LL | | }
10+
| |_- this function will not propagate the caller location
11+
|
12+
= note: see issue #110011 <https://github.com/rust-lang/rust/issues/110011> for more information
13+
= help: add `#![feature(async_fn_track_caller)]` to the crate attributes to enable
14+
= note: `#[warn(ungated_async_fn_track_caller)]` on by default
15+
16+
warning: `#[track_caller]` on async functions is a no-op
17+
--> $DIR/panic-track-caller.rs:67:5
18+
|
19+
LL | #[track_caller]
20+
| ^^^^^^^^^^^^^^^
21+
...
22+
LL | / async fn bar_assoc() {
23+
LL | | panic!();
24+
LL | | }
25+
| |_____- this function will not propagate the caller location
26+
|
27+
= note: see issue #110011 <https://github.com/rust-lang/rust/issues/110011> for more information
28+
= help: add `#![feature(async_fn_track_caller)]` to the crate attributes to enable
29+
30+
warning: 2 warnings emitted
31+
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
warning: `#[track_caller]` on async functions is a no-op
2-
--> $DIR/panic-track-caller.rs:50:1
2+
--> $DIR/panic-track-caller.rs:53:1
33
|
44
LL | #[track_caller]
55
| ^^^^^^^^^^^^^^^
6+
...
67
LL | / async fn bar_track_caller() {
78
LL | | panic!()
89
LL | | }
910
| |_- this function will not propagate the caller location
1011
|
11-
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
12-
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
12+
= note: see issue #110011 <https://github.com/rust-lang/rust/issues/110011> for more information
13+
= help: add `#![feature(async_fn_track_caller)]` to the crate attributes to enable
1314
= note: `#[warn(ungated_async_fn_track_caller)]` on by default
1415

1516
warning: `#[track_caller]` on async functions is a no-op
16-
--> $DIR/panic-track-caller.rs:62:5
17+
--> $DIR/panic-track-caller.rs:67:5
1718
|
1819
LL | #[track_caller]
1920
| ^^^^^^^^^^^^^^^
21+
...
2022
LL | / async fn bar_assoc() {
2123
LL | | panic!();
2224
LL | | }
2325
| |_____- this function will not propagate the caller location
2426
|
25-
= note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
26-
= help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
27+
= note: see issue #110011 <https://github.com/rust-lang/rust/issues/110011> for more information
28+
= help: add `#![feature(async_fn_track_caller)]` to the crate attributes to enable
2729

2830
warning: 2 warnings emitted
2931

‎tests/ui/async-await/track-caller/panic-track-caller.rs

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
// run-pass
22
// edition:2021
3-
// revisions: feat nofeat
3+
// revisions: afn cls nofeat
44
// needs-unwind
5+
// gate-test-async_fn_track_caller
56
#![feature(async_closure, stmt_expr_attributes)]
6-
#![cfg_attr(feat, feature(closure_track_caller))]
7+
#![cfg_attr(afn, feature(async_fn_track_caller))]
8+
#![cfg_attr(cls, feature(closure_track_caller))]
9+
#![allow(unused)]
710

811
use std::future::Future;
912
use std::panic;
@@ -47,7 +50,9 @@ async fn foo() {
4750
bar().await
4851
}
4952

50-
#[track_caller] //[nofeat]~ WARN `#[track_caller]` on async functions is a no-op
53+
#[track_caller]
54+
//[cls]~^ WARN `#[track_caller]` on async functions is a no-op
55+
//[nofeat]~^^ WARN `#[track_caller]` on async functions is a no-op
5156
async fn bar_track_caller() {
5257
panic!()
5358
}
@@ -59,7 +64,9 @@ async fn foo_track_caller() {
5964
struct Foo;
6065

6166
impl Foo {
62-
#[track_caller] //[nofeat]~ WARN `#[track_caller]` on async functions is a no-op
67+
#[track_caller]
68+
//[cls]~^ WARN `#[track_caller]` on async functions is a no-op
69+
//[nofeat]~^^ WARN `#[track_caller]` on async functions is a no-op
6370
async fn bar_assoc() {
6471
panic!();
6572
}
@@ -71,7 +78,7 @@ async fn foo_assoc() {
7178

7279
// Since compilation is expected to fail for this fn when using
7380
// `nofeat`, we test that separately in `async-closure-gate.rs`
74-
#[cfg(feat)]
81+
#[cfg(cls)]
7582
async fn foo_closure() {
7683
let c = #[track_caller] async || {
7784
panic!();
@@ -81,7 +88,7 @@ async fn foo_closure() {
8188

8289
// Since compilation is expected to fail for this fn when using
8390
// `nofeat`, we test that separately in `async-block.rs`
84-
#[cfg(feat)]
91+
#[cfg(cls)]
8592
async fn foo_block() {
8693
let a = #[track_caller] async {
8794
panic!();
@@ -106,21 +113,22 @@ fn panicked_at(f: impl FnOnce() + panic::UnwindSafe) -> u32 {
106113
}
107114

108115
fn main() {
109-
assert_eq!(panicked_at(|| block_on(foo())), 43);
116+
assert_eq!(panicked_at(|| block_on(foo())), 46
117+
);
110118

111-
#[cfg(feat)]
112-
assert_eq!(panicked_at(|| block_on(foo_track_caller())), 56);
113-
#[cfg(nofeat)]
114-
assert_eq!(panicked_at(|| block_on(foo_track_caller())), 52);
119+
#[cfg(afn)]
120+
assert_eq!(panicked_at(|| block_on(foo_track_caller())), 61);
121+
#[cfg(any(cls, nofeat))]
122+
assert_eq!(panicked_at(|| block_on(foo_track_caller())), 57);
115123

116-
#[cfg(feat)]
117-
assert_eq!(panicked_at(|| block_on(foo_assoc())), 69);
118-
#[cfg(nofeat)]
119-
assert_eq!(panicked_at(|| block_on(foo_assoc())), 64);
124+
#[cfg(afn)]
125+
assert_eq!(panicked_at(|| block_on(foo_assoc())), 76);
126+
#[cfg(any(cls, nofeat))]
127+
assert_eq!(panicked_at(|| block_on(foo_assoc())), 71);
120128

121-
#[cfg(feat)]
122-
assert_eq!(panicked_at(|| block_on(foo_closure())), 79);
129+
#[cfg(cls)]
130+
assert_eq!(panicked_at(|| block_on(foo_closure())), 84);
123131

124-
#[cfg(feat)]
125-
assert_eq!(panicked_at(|| block_on(foo_block())), 89);
132+
#[cfg(cls)]
133+
assert_eq!(panicked_at(|| block_on(foo_block())), 96);
126134
}

‎tests/ui/proc-macro/meta-macro-hygiene.stdout

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Respanned: TokenStream [Ident { ident: "$crate", span: $DIR/auxiliary/make-macro
1818
use core /* 0#1 */::prelude /* 0#1 */::rust_2018 /* 0#1 */::*;
1919
#[macro_use /* 0#1 */]
2020
extern crate core /* 0#1 */;
21-
extern crate compiler_builtins /* 443 */ as _ /* 0#1 */;
21+
extern crate compiler_builtins /* 444 */ as _ /* 0#1 */;
2222
// Don't load unnecessary hygiene information from std
2323
extern crate std /* 0#0 */;
2424

‎tests/ui/proc-macro/nonterminal-token-hygiene.stdout

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
3939
use ::core /* 0#1 */::prelude /* 0#1 */::rust_2015 /* 0#1 */::*;
4040
#[macro_use /* 0#1 */]
4141
extern crate core /* 0#2 */;
42-
extern crate compiler_builtins /* 443 */ as _ /* 0#2 */;
42+
extern crate compiler_builtins /* 444 */ as _ /* 0#2 */;
4343
// Don't load unnecessary hygiene information from std
4444
extern crate std /* 0#0 */;
4545

0 commit comments

Comments
 (0)
Please sign in to comment.