#![feature(never_type)]
#![feature(nll)]
#![feature(in_band_lifetimes)]
+#![feature(iter_zip)]
#![recursion_limit = "256"]
#[macro_use]
// FIXME(eddyb) Precompute a custom symbol name based on attributes.
let is_foreign = if let Some(def_id) = def_id.as_local() {
- if tcx.plugin_registrar_fn(()) == Some(def_id) {
- let stable_crate_id = tcx.sess.local_stable_crate_id();
- return tcx.sess.generate_plugin_registrar_symbol(stable_crate_id);
- }
if tcx.proc_macro_decls_static(()) == Some(def_id) {
let stable_crate_id = tcx.sess.local_stable_crate_id();
return tcx.sess.generate_proc_macro_decls_symbol(stable_crate_id);
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 {