@@ -678,30 +678,32 @@ impl<'hir> LoweringContext<'_, 'hir> {
678
678
hir:: ExprKind :: Closure ( c)
679
679
} ;
680
680
681
- let track_caller = outer_hir_id
682
- . and_then ( |id| self . attrs . get ( & id. local_id ) )
683
- . map_or ( false , |attrs| attrs. into_iter ( ) . any ( |attr| attr. has_name ( sym:: track_caller) ) ) ;
684
-
685
681
let hir_id = self . lower_node_id ( closure_node_id) ;
686
682
let unstable_span =
687
683
self . mark_span_with_reason ( DesugaringKind :: Async , span, self . allow_gen_future . clone ( ) ) ;
688
- if track_caller {
689
- self . lower_attrs (
690
- hir_id,
691
- & [ Attribute {
692
- kind : AttrKind :: Normal ( ptr:: P ( NormalAttr {
693
- item : AttrItem {
694
- path : Path :: from_ident ( Ident :: new ( sym:: track_caller, span) ) ,
695
- args : AttrArgs :: Empty ,
684
+ if self . tcx . features ( ) . closure_track_caller {
685
+ let track_caller =
686
+ outer_hir_id. and_then ( |id| self . attrs . get ( & id. local_id ) ) . map_or ( false , |attrs| {
687
+ attrs. into_iter ( ) . any ( |attr| attr. has_name ( sym:: track_caller) )
688
+ } ) ;
689
+ if track_caller {
690
+ self . lower_attrs (
691
+ hir_id,
692
+ & [ Attribute {
693
+ kind : AttrKind :: Normal ( ptr:: P ( NormalAttr {
694
+ item : AttrItem {
695
+ path : Path :: from_ident ( Ident :: new ( sym:: track_caller, span) ) ,
696
+ args : AttrArgs :: Empty ,
697
+ tokens : None ,
698
+ } ,
696
699
tokens : None ,
697
- } ,
698
- tokens : None ,
699
- } ) ) ,
700
- id : self . tcx . sess . parse_sess . attr_id_generator . mk_attr_id ( ) ,
701
- style : AttrStyle :: Outer ,
702
- span : unstable_span,
703
- } ] ,
704
- ) ;
700
+ } ) ) ,
701
+ id : self . tcx . sess . parse_sess . attr_id_generator . mk_attr_id ( ) ,
702
+ style : AttrStyle :: Outer ,
703
+ span : unstable_span,
704
+ } ] ,
705
+ ) ;
706
+ }
705
707
}
706
708
707
709
let generator = hir:: Expr { hir_id, kind : generator_kind, span : self . lower_span ( span) } ;
0 commit comments