@@ -548,7 +548,7 @@ fn item_function(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, f: &cle
548548 w,
549549 "{attrs}{vis}{constness}{asyncness}{unsafety}{abi}fn \
550550 {name}{generics}{decl}{notable_traits}{where_clause}",
551- attrs = render_attributes_in_pre( it, "" ) ,
551+ attrs = render_attributes_in_pre( it, "" , tcx ) ,
552552 vis = visibility,
553553 constness = constness,
554554 asyncness = asyncness,
@@ -589,7 +589,7 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
589589 it. name. unwrap( ) ,
590590 t. generics. print( cx) ,
591591 bounds,
592- attrs = render_attributes_in_pre( it, "" ) ,
592+ attrs = render_attributes_in_pre( it, "" , tcx ) ,
593593 ) ;
594594
595595 if !t. generics . where_predicates . is_empty ( ) {
@@ -1063,7 +1063,7 @@ fn item_trait_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &
10631063 t. generics. print( cx) ,
10641064 print_where_clause( & t. generics, cx, 0 , Ending :: Newline ) ,
10651065 bounds( & t. bounds, true , cx) ,
1066- attrs = render_attributes_in_pre( it, "" ) ,
1066+ attrs = render_attributes_in_pre( it, "" , cx . tcx ( ) ) ,
10671067 ) ;
10681068 } ) ;
10691069
@@ -1085,7 +1085,7 @@ fn item_opaque_ty(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &cl
10851085 t. generics. print( cx) ,
10861086 where_clause = print_where_clause( & t. generics, cx, 0 , Ending :: Newline ) ,
10871087 bounds = bounds( & t. bounds, false , cx) ,
1088- attrs = render_attributes_in_pre( it, "" ) ,
1088+ attrs = render_attributes_in_pre( it, "" , cx . tcx ( ) ) ,
10891089 ) ;
10901090 } ) ;
10911091
@@ -1109,7 +1109,7 @@ fn item_typedef(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clea
11091109 t. generics. print( cx) ,
11101110 where_clause = print_where_clause( & t. generics, cx, 0 , Ending :: Newline ) ,
11111111 type_ = t. type_. print( cx) ,
1112- attrs = render_attributes_in_pre( it, "" ) ,
1112+ attrs = render_attributes_in_pre( it, "" , cx . tcx ( ) ) ,
11131113 ) ;
11141114 } ) ;
11151115 }
@@ -1168,7 +1168,8 @@ fn item_union(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean:
11681168 & ' b self ,
11691169 ) -> impl fmt:: Display + Captures < ' a > + ' b + Captures < ' cx > {
11701170 display_fn ( move |f| {
1171- let v = render_attributes_in_pre ( self . it , "" ) ;
1171+ let tcx = self . cx . borrow ( ) . tcx ( ) ;
1172+ let v = render_attributes_in_pre ( self . it , "" , tcx) ;
11721173 write ! ( f, "{v}" )
11731174 } )
11741175 }
@@ -1244,13 +1245,13 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
12441245 let tcx = cx. tcx ( ) ;
12451246 let count_variants = e. variants ( ) . count ( ) ;
12461247 wrap_item ( w, |mut w| {
1248+ render_attributes_in_code ( w, it, tcx) ;
12471249 write ! (
12481250 w,
1249- "{attrs}{ }enum {}{}" ,
1251+ "{}enum {}{}" ,
12501252 visibility_print_with_space( it. visibility( tcx) , it. item_id, cx) ,
12511253 it. name. unwrap( ) ,
12521254 e. generics. print( cx) ,
1253- attrs = render_attributes_in_pre( it, "" ) ,
12541255 ) ;
12551256 if !print_where_clause_and_check ( w, & e. generics , cx) {
12561257 // If there wasn't a `where` clause, we add a whitespace.
@@ -1445,7 +1446,7 @@ fn item_primitive(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item) {
14451446fn item_constant ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , c : & clean:: Constant ) {
14461447 wrap_item ( w, |w| {
14471448 let tcx = cx. tcx ( ) ;
1448- render_attributes_in_code ( w, it) ;
1449+ render_attributes_in_code ( w, it, tcx ) ;
14491450
14501451 write ! (
14511452 w,
@@ -1492,7 +1493,7 @@ fn item_constant(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, c: &cle
14921493
14931494fn item_struct ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Struct ) {
14941495 wrap_item ( w, |w| {
1495- render_attributes_in_code ( w, it) ;
1496+ render_attributes_in_code ( w, it, cx . tcx ( ) ) ;
14961497 render_struct ( w, it, Some ( & s. generics ) , s. ctor_kind , & s. fields , "" , true , cx) ;
14971498 } ) ;
14981499
@@ -1542,7 +1543,7 @@ fn item_struct(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean
15421543
15431544fn item_static ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Static ) {
15441545 wrap_item ( w, |w| {
1545- render_attributes_in_code ( w, it) ;
1546+ render_attributes_in_code ( w, it, cx . tcx ( ) ) ;
15461547 write ! (
15471548 w,
15481549 "{vis}static {mutability}{name}: {typ}" ,
@@ -1558,7 +1559,7 @@ fn item_static(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean
15581559fn item_foreign_type ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item ) {
15591560 wrap_item ( w, |w| {
15601561 w. write_str ( "extern {\n " ) ;
1561- render_attributes_in_code ( w, it) ;
1562+ render_attributes_in_code ( w, it, cx . tcx ( ) ) ;
15621563 write ! (
15631564 w,
15641565 " {}type {};\n }}" ,
0 commit comments