Skip to content

Commit

Permalink
Rollup merge of #85534 - csmoe:demagnle-assert, r=michaelwoerister
Browse files Browse the repository at this point in the history
add rustc-demangle assertion on mangled symbol

cc #60705 (comment)
r? `@michaelwoerister`
  • Loading branch information
GuillaumeGomez authored Aug 29, 2021
2 parents 22973a8 + 5eb960c commit 63cfbf5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions compiler/rustc_symbol_mangling/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,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 63cfbf5

Please sign in to comment.