mangling: non-monomorphic #[rustc_symbol_name]
This commit adjust `#[rustc_symbol_name]` so that it can be applied to non-monomorphic functions without producing an ICE. Signed-off-by: David Wood <david@davidtw.co>
This commit is contained in:
parent
5565241f65
commit
9752787dca
4 changed files with 19 additions and 21 deletions
|
@ -291,7 +291,17 @@ impl<'tcx> Instance<'tcx> {
|
|||
}
|
||||
|
||||
pub fn mono(tcx: TyCtxt<'tcx>, def_id: DefId) -> Instance<'tcx> {
|
||||
Instance::new(def_id, tcx.empty_substs_for_def_id(def_id))
|
||||
let substs = InternalSubsts::for_item(tcx, def_id, |param, _| match param.kind {
|
||||
ty::GenericParamDefKind::Lifetime => tcx.lifetimes.re_erased.into(),
|
||||
ty::GenericParamDefKind::Type { .. } => {
|
||||
bug!("Instance::mono: {:?} has type parameters", def_id)
|
||||
}
|
||||
ty::GenericParamDefKind::Const { .. } => {
|
||||
bug!("Instance::mono: {:?} has const parameters", def_id)
|
||||
}
|
||||
});
|
||||
|
||||
Instance::new(def_id, substs)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue