Skip to content

Commit

Permalink
add rustc-demangle assertion on mangled symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
csmoe committed Aug 27, 2021
1 parent be8450e commit 5eb960c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions compiler/rustc_symbol_mangling/src/lib.rs
Expand Up @@ -250,10 +250,18 @@ fn compute_symbol_name(
tcx.symbol_mangling_version(mangling_version_crate)
};

match mangling_version {
let symbol = match mangling_version {
SymbolManglingVersion::Legacy => legacy::mangle(tcx, instance, instantiating_crate),
SymbolManglingVersion::V0 => v0::mangle(tcx, instance, instantiating_crate),
}
};

debug_assert!(
rustc_demangle::try_demangle(&symbol).is_ok(),
"compute_symbol_name: `{}` cannot be demangled",
symbol
);

symbol
}

fn is_generic(substs: SubstsRef<'_>) -> bool {
Expand Down

0 comments on commit 5eb960c

Please sign in to comment.