@@ -54,6 +54,7 @@ use rustc_span::symbol::{kw, sym, Symbol};
54
54
use serde:: ser:: SerializeSeq ;
55
55
use serde:: { Serialize , Serializer } ;
56
56
57
+ use crate :: clean:: utils:: print_const_expr;
57
58
use crate :: clean:: { self , FakeDefId , GetDefId , RenderedLink , SelfTy } ;
58
59
use crate :: docfs:: PathError ;
59
60
use crate :: error:: Error ;
@@ -739,6 +740,7 @@ fn naive_assoc_href(it: &clean::Item, link: AssocItemLink<'_>, cx: &Context<'_>)
739
740
let name = it. name . as_ref ( ) . unwrap ( ) ;
740
741
let ty = match it. type_ ( ) {
741
742
Typedef | AssocType => AssocType ,
743
+ Constant | AssocConst => AssocConst ,
742
744
s => s,
743
745
} ;
744
746
@@ -1366,6 +1368,35 @@ fn render_impl(
1366
1368
w. write_str ( "</h4>" ) ;
1367
1369
}
1368
1370
}
1371
+ clean:: ConstantItem ( clean:: Constant {
1372
+ type_ : ref ty,
1373
+ kind : clean:: ConstantKind :: Local { body, .. } ,
1374
+ } ) => {
1375
+ let item_type = ItemType :: AssocConst ;
1376
+ let source_id = format ! ( "{}.{}" , item_type, name) ;
1377
+ let id = cx. derive_id ( source_id. clone ( ) ) ;
1378
+ write ! ( w, "<h4 id=\" {}\" class=\" {}{}\" ><code>" , id, item_type, in_trait_class) ;
1379
+ assoc_const (
1380
+ w,
1381
+ item,
1382
+ ty,
1383
+ Some ( & print_const_expr ( tcx, body) ) ,
1384
+ link. anchor ( if trait_. is_some ( ) { & source_id } else { & id } ) ,
1385
+ "" ,
1386
+ cx,
1387
+ ) ;
1388
+ w. write_str ( "</code>" ) ;
1389
+ render_stability_since_raw (
1390
+ w,
1391
+ item. stable_since ( tcx) . as_deref ( ) ,
1392
+ item. const_stable_since ( tcx) . as_deref ( ) ,
1393
+ outer_version,
1394
+ outer_const_version,
1395
+ ) ;
1396
+ write ! ( w, "<a href=\" #{}\" class=\" anchor\" ></a>" , id) ;
1397
+ write_srclink ( cx, item, w) ;
1398
+ w. write_str ( "</h4>" ) ;
1399
+ }
1369
1400
clean:: TypedefItem ( ref tydef, _) => {
1370
1401
let source_id = format ! ( "{}.{}" , ItemType :: AssocType , name) ;
1371
1402
let id = cx. derive_id ( source_id. clone ( ) ) ;
0 commit comments