File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -1545,10 +1545,19 @@ define_print_and_forward_display! {
15451545 }
15461546 if let ConstValue :: Unevaluated ( did, substs) = self . val {
15471547 match cx. tcx( ) . describe_def( did) {
1548- | Some ( Def :: Static ( _, _) )
1549- | Some ( Def :: Const ( _, false ) )
1550- | Some ( Def :: AssociatedConst ( _) ) => p!( write( "{}" , cx. tcx( ) . def_path_str( did) ) ) ,
1551- _ => p!( write( "_" ) ) ,
1548+ | Some ( Def :: Static ( _) )
1549+ | Some ( Def :: Const ( _) )
1550+ | Some ( Def :: AssociatedConst ( _) ) => p!( print_value_path( did, substs) ) ,
1551+ _ => if did. is_local( ) {
1552+ let span = cx. tcx( ) . def_span( did) ;
1553+ if let Ok ( snip) = cx. tcx( ) . sess. source_map( ) . span_to_snippet( span) {
1554+ p!( write( "{}" , snip) )
1555+ } else {
1556+ p!( write( "_" ) )
1557+ }
1558+ } else {
1559+ p!( write( "_" ) )
1560+ } ,
15521561 }
15531562 return Ok ( cx) ;
15541563 }
You can’t perform that action at this time.
0 commit comments