Skip to content

Commit

Permalink
Always omit zero disambiguators on crate-roots.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwoerister committed Apr 29, 2024
1 parent af38dc6 commit 458f9b1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ impl<'a, 'b, 's> Printer<'a, 'b, 's> {

self.print(name)?;
if let Some(out) = &mut self.out {
if !out.alternate() {
if !out.alternate() && dis != 0 {
out.write_str("[")?;
fmt::LowerHex::fmt(&dis, out)?;
out.write_str("]")?;
Expand Down Expand Up @@ -1271,7 +1271,7 @@ mod tests {
t_const!($mangled, $value);
t!(
concat!("_RIC0K", $mangled, "E"),
concat!("[0]::<", $value, $value_ty_suffix, ">")
concat!("::<", $value, $value_ty_suffix, ">")
);
}};
}
Expand All @@ -1281,6 +1281,12 @@ mod tests {
t_nohash!("_RNvC6_123foo3bar", "123foo::bar");
}

#[test]
fn demangle_crate_with_zero_disambiguator() {
t!("_RC4f128", "f128");
t_nohash!("_RC4f128", "f128");
}

#[test]
fn demangle_utf8_idents() {
t_nohash!(
Expand Down

0 comments on commit 458f9b1

Please sign in to comment.