@@ -548,7 +548,7 @@ fn item_function(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, f: &cle
548
548
w,
549
549
"{attrs}{vis}{constness}{asyncness}{unsafety}{abi}fn \
550
550
{name}{generics}{decl}{notable_traits}{where_clause}",
551
- attrs = render_attributes_in_pre( it, "" ) ,
551
+ attrs = render_attributes_in_pre( it, "" , tcx ) ,
552
552
vis = visibility,
553
553
constness = constness,
554
554
asyncness = asyncness,
@@ -589,7 +589,7 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
589
589
it. name. unwrap( ) ,
590
590
t. generics. print( cx) ,
591
591
bounds,
592
- attrs = render_attributes_in_pre( it, "" ) ,
592
+ attrs = render_attributes_in_pre( it, "" , tcx ) ,
593
593
) ;
594
594
595
595
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: &
1063
1063
t. generics. print( cx) ,
1064
1064
print_where_clause( & t. generics, cx, 0 , Ending :: Newline ) ,
1065
1065
bounds( & t. bounds, true , cx) ,
1066
- attrs = render_attributes_in_pre( it, "" ) ,
1066
+ attrs = render_attributes_in_pre( it, "" , cx . tcx ( ) ) ,
1067
1067
) ;
1068
1068
} ) ;
1069
1069
@@ -1085,7 +1085,7 @@ fn item_opaque_ty(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &cl
1085
1085
t. generics. print( cx) ,
1086
1086
where_clause = print_where_clause( & t. generics, cx, 0 , Ending :: Newline ) ,
1087
1087
bounds = bounds( & t. bounds, false , cx) ,
1088
- attrs = render_attributes_in_pre( it, "" ) ,
1088
+ attrs = render_attributes_in_pre( it, "" , cx . tcx ( ) ) ,
1089
1089
) ;
1090
1090
} ) ;
1091
1091
@@ -1109,7 +1109,7 @@ fn item_typedef(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clea
1109
1109
t. generics. print( cx) ,
1110
1110
where_clause = print_where_clause( & t. generics, cx, 0 , Ending :: Newline ) ,
1111
1111
type_ = t. type_. print( cx) ,
1112
- attrs = render_attributes_in_pre( it, "" ) ,
1112
+ attrs = render_attributes_in_pre( it, "" , cx . tcx ( ) ) ,
1113
1113
) ;
1114
1114
} ) ;
1115
1115
}
@@ -1168,7 +1168,8 @@ fn item_union(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean:
1168
1168
& ' b self ,
1169
1169
) -> impl fmt:: Display + Captures < ' a > + ' b + Captures < ' cx > {
1170
1170
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) ;
1172
1173
write ! ( f, "{v}" )
1173
1174
} )
1174
1175
}
@@ -1244,13 +1245,13 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
1244
1245
let tcx = cx. tcx ( ) ;
1245
1246
let count_variants = e. variants ( ) . count ( ) ;
1246
1247
wrap_item ( w, |mut w| {
1248
+ render_attributes_in_code ( w, it, tcx) ;
1247
1249
write ! (
1248
1250
w,
1249
- "{attrs}{ }enum {}{}" ,
1251
+ "{}enum {}{}" ,
1250
1252
visibility_print_with_space( it. visibility( tcx) , it. item_id, cx) ,
1251
1253
it. name. unwrap( ) ,
1252
1254
e. generics. print( cx) ,
1253
- attrs = render_attributes_in_pre( it, "" ) ,
1254
1255
) ;
1255
1256
if !print_where_clause_and_check ( w, & e. generics , cx) {
1256
1257
// 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) {
1445
1446
fn item_constant ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , c : & clean:: Constant ) {
1446
1447
wrap_item ( w, |w| {
1447
1448
let tcx = cx. tcx ( ) ;
1448
- render_attributes_in_code ( w, it) ;
1449
+ render_attributes_in_code ( w, it, tcx ) ;
1449
1450
1450
1451
write ! (
1451
1452
w,
@@ -1492,7 +1493,7 @@ fn item_constant(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, c: &cle
1492
1493
1493
1494
fn item_struct ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Struct ) {
1494
1495
wrap_item ( w, |w| {
1495
- render_attributes_in_code ( w, it) ;
1496
+ render_attributes_in_code ( w, it, cx . tcx ( ) ) ;
1496
1497
render_struct ( w, it, Some ( & s. generics ) , s. ctor_kind , & s. fields , "" , true , cx) ;
1497
1498
} ) ;
1498
1499
@@ -1542,7 +1543,7 @@ fn item_struct(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean
1542
1543
1543
1544
fn item_static ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item , s : & clean:: Static ) {
1544
1545
wrap_item ( w, |w| {
1545
- render_attributes_in_code ( w, it) ;
1546
+ render_attributes_in_code ( w, it, cx . tcx ( ) ) ;
1546
1547
write ! (
1547
1548
w,
1548
1549
"{vis}static {mutability}{name}: {typ}" ,
@@ -1558,7 +1559,7 @@ fn item_static(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean
1558
1559
fn item_foreign_type ( w : & mut Buffer , cx : & mut Context < ' _ > , it : & clean:: Item ) {
1559
1560
wrap_item ( w, |w| {
1560
1561
w. write_str ( "extern {\n " ) ;
1561
- render_attributes_in_code ( w, it) ;
1562
+ render_attributes_in_code ( w, it, cx . tcx ( ) ) ;
1562
1563
write ! (
1563
1564
w,
1564
1565
" {}type {};\n }}" ,
0 commit comments