Skip to content

Commit 0ad7b13

Browse files
Always omit zero disambiguators on crate-roots.
1 parent af38dc6 commit 0ad7b13

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/v0.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -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("]")?;
@@ -1271,7 +1271,7 @@ mod tests {
12711271
t_const!($mangled, $value);
12721272
t!(
12731273
concat!("_RIC0K", $mangled, "E"),
1274-
concat!("[0]::<", $value, $value_ty_suffix, ">")
1274+
concat!("::<", $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

Comments
 (0)