@@ -803,7 +803,7 @@ impl<'a, 'b, 's> Printer<'a, 'b, 's> {
803803
804804 self . print ( name) ?;
805805 if let Some ( out) = & mut self . out {
806- if !out. alternate ( ) {
806+ if !out. alternate ( ) && dis != 0 {
807807 out. write_str ( "[" ) ?;
808808 fmt:: LowerHex :: fmt ( & dis, out) ?;
809809 out. write_str ( "]" ) ?;
@@ -1261,17 +1261,17 @@ mod tests {
12611261 macro_rules! t_const {
12621262 ( $mangled: expr, $value: expr) => {
12631263 t_nohash!(
1264- concat!( "_RIC0K " , $mangled, "E" ) ,
1265- concat!( "::<" , $value, ">" )
1264+ concat!( "_RIC8my_crateK " , $mangled, "E" ) ,
1265+ concat!( "my_crate ::<" , $value, ">" )
12661266 )
12671267 } ;
12681268 }
12691269 macro_rules! t_const_suffixed {
12701270 ( $mangled: expr, $value: expr, $value_ty_suffix: expr) => { {
12711271 t_const!( $mangled, $value) ;
12721272 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, ">" )
12751275 ) ;
12761276 } } ;
12771277 }
@@ -1281,6 +1281,12 @@ mod tests {
12811281 t_nohash ! ( "_RNvC6_123foo3bar" , "123foo::bar" ) ;
12821282 }
12831283
1284+ #[ test]
1285+ fn demangle_crate_with_zero_disambiguator ( ) {
1286+ t ! ( "_RC4f128" , "f128" ) ;
1287+ t_nohash ! ( "_RC4f128" , "f128" ) ;
1288+ }
1289+
12841290 #[ test]
12851291 fn demangle_utf8_idents ( ) {
12861292 t_nohash ! (
0 commit comments