@@ -803,7 +803,7 @@ impl<'a, 'b, 's> Printer<'a, 'b, 's> {
803
803
804
804
self . print ( name) ?;
805
805
if let Some ( out) = & mut self . out {
806
- if !out. alternate ( ) {
806
+ if !out. alternate ( ) && dis != 0 {
807
807
out. write_str ( "[" ) ?;
808
808
fmt:: LowerHex :: fmt ( & dis, out) ?;
809
809
out. write_str ( "]" ) ?;
@@ -1261,17 +1261,17 @@ mod tests {
1261
1261
macro_rules! t_const {
1262
1262
( $mangled: expr, $value: expr) => {
1263
1263
t_nohash!(
1264
- concat!( "_RIC0K " , $mangled, "E" ) ,
1265
- concat!( "::<" , $value, ">" )
1264
+ concat!( "_RIC8my_crateK " , $mangled, "E" ) ,
1265
+ concat!( "my_crate ::<" , $value, ">" )
1266
1266
)
1267
1267
} ;
1268
1268
}
1269
1269
macro_rules! t_const_suffixed {
1270
1270
( $mangled: expr, $value: expr, $value_ty_suffix: expr) => { {
1271
1271
t_const!( $mangled, $value) ;
1272
1272
t!(
1273
- concat!( "_RIC0K " , $mangled, "E" ) ,
1274
- concat!( "[0] ::<" , $value, $value_ty_suffix, ">" )
1273
+ concat!( "_RIC8my_crateK " , $mangled, "E" ) ,
1274
+ concat!( "my_crate ::<" , $value, $value_ty_suffix, ">" )
1275
1275
) ;
1276
1276
} } ;
1277
1277
}
@@ -1281,6 +1281,12 @@ mod tests {
1281
1281
t_nohash ! ( "_RNvC6_123foo3bar" , "123foo::bar" ) ;
1282
1282
}
1283
1283
1284
+ #[ test]
1285
+ fn demangle_crate_with_zero_disambiguator ( ) {
1286
+ t ! ( "_RC4f128" , "f128" ) ;
1287
+ t_nohash ! ( "_RC4f128" , "f128" ) ;
1288
+ }
1289
+
1284
1290
#[ test]
1285
1291
fn demangle_utf8_idents ( ) {
1286
1292
t_nohash ! (
0 commit comments