@@ -656,34 +656,35 @@ impl<'hir> LoweringContext<'_, 'hir> {
656
656
hir:: ExprKind :: Closure ( c)
657
657
} ;
658
658
659
- let track_caller = self
660
- . attrs
661
- . get ( & outer_hir_id. local_id )
662
- . map_or ( false , |attrs| attrs. into_iter ( ) . any ( |attr| attr. has_name ( sym:: track_caller) ) ) ;
663
-
664
659
let hir_id = self . lower_node_id ( closure_node_id) ;
665
- if track_caller {
666
- let unstable_span = self . mark_span_with_reason (
667
- DesugaringKind :: Async ,
668
- span,
669
- self . allow_gen_future . clone ( ) ,
670
- ) ;
671
- self . lower_attrs (
672
- hir_id,
673
- & [ Attribute {
674
- kind : AttrKind :: Normal ( ptr:: P ( NormalAttr {
675
- item : AttrItem {
676
- path : Path :: from_ident ( Ident :: new ( sym:: track_caller, span) ) ,
677
- args : AttrArgs :: Empty ,
660
+ let unstable_span = self . mark_span_with_reason (
661
+ DesugaringKind :: Async ,
662
+ span,
663
+ self . allow_gen_future . clone ( ) ,
664
+ ) ;
665
+ if self . tcx . features ( ) . closure_track_caller {
666
+ let track_caller = self
667
+ . attrs
668
+ . get ( & outer_hir_id. local_id )
669
+ . map_or ( false , |attrs| attrs. into_iter ( ) . any ( |attr| attr. has_name ( sym:: track_caller) ) ) ;
670
+ if track_caller {
671
+ self . lower_attrs (
672
+ hir_id,
673
+ & [ Attribute {
674
+ kind : AttrKind :: Normal ( ptr:: P ( NormalAttr {
675
+ item : AttrItem {
676
+ path : Path :: from_ident ( Ident :: new ( sym:: track_caller, span) ) ,
677
+ args : AttrArgs :: Empty ,
678
+ tokens : None ,
679
+ } ,
678
680
tokens : None ,
679
- } ,
680
- tokens : None ,
681
- } ) ) ,
682
- id : self . tcx . sess . parse_sess . attr_id_generator . mk_attr_id ( ) ,
683
- style : AttrStyle :: Outer ,
684
- span : unstable_span,
685
- } ] ,
686
- ) ;
681
+ } ) ) ,
682
+ id : self . tcx . sess . parse_sess . attr_id_generator . mk_attr_id ( ) ,
683
+ style : AttrStyle :: Outer ,
684
+ span : unstable_span,
685
+ } ] ,
686
+ ) ;
687
+ }
687
688
}
688
689
689
690
let generator = hir:: Expr { hir_id, kind : generator_kind, span : self . lower_span ( span) } ;
0 commit comments