about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src/expr.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-12-22 11:06:51 +0000
committerbors <bors@rust-lang.org>2022-12-22 11:06:51 +0000
commit2d8651a92761421b0437ffb44ba5670bea5ee1df (patch)
treeeaeaa01be5cc193d6bdc3cbcf302484992bd879a /compiler/rustc_ast_lowering/src/expr.rs
parentcce9e72c55994335f8d1dac892cca755b65c8f43 (diff)
parentd2130e42749ae6144edead4427eb66fa458d8a67 (diff)
downloadrust-2d8651a92761421b0437ffb44ba5670bea5ee1df.tar.gz
rust-2d8651a92761421b0437ffb44ba5670bea5ee1df.zip
Auto merge of #106034 - matthiaskrgr:rollup-2zpql33, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #104741 (Switch `#[track_caller]` back to a no-op unless feature gate is enabled)
 - #105769 (add function to tell the identical errors for ambiguity_errors)
 - #105843 (Suggest associated const on possible capitalization mistake)
 - #105966 (Re-enable `Fn` trait call notation error for non-tuple argument)
 - #106002 (codegen tests: adapt patterns to also work with v0 symbol mangling)
 - #106010 (Give opaque types a better coherence error)
 - #106016 (rustdoc: simplify link anchor to section expand JS)
 - #106024 (Fix ICE due to `todo!()` in `rustdoc` for `Term`s)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_ast_lowering/src/expr.rs')
-rw-r--r--compiler/rustc_ast_lowering/src/expr.rs18
1 files changed, 7 insertions, 11 deletions
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs
index a3f5c18f2e7..3634e6e47ce 100644
--- a/compiler/rustc_ast_lowering/src/expr.rs
+++ b/compiler/rustc_ast_lowering/src/expr.rs
@@ -656,18 +656,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
             hir::ExprKind::Closure(c)
         };
 
-        let track_caller = self
-            .attrs
-            .get(&outer_hir_id.local_id)
-            .map_or(false, |attrs| attrs.into_iter().any(|attr| attr.has_name(sym::track_caller)));
-
         let hir_id = self.lower_node_id(closure_node_id);
-        if track_caller {
-            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)
+            && attrs.into_iter().any(|attr| attr.has_name(sym::track_caller))
+        {
             self.lower_attrs(
                 hir_id,
                 &[Attribute {