Conditionally call normalize_erasing_regions only if polymorhization is enabled

This commit is contained in:
jackh726 2021-07-13 15:09:01 -04:00
parent a9f1e1c440
commit 09978bdcd1

View File

@ -2478,9 +2478,10 @@ fn fn_sig_for_fn_abi(&self, tcx: TyCtxt<'tcx>) -> ty::PolyFnSig<'tcx> {
// `src/test/ui/polymorphization/normalized_sig_types.rs`), and codegen not keeping
// track of a polymorphization `ParamEnv` to allow normalizing later.
let mut sig = match *ty.kind() {
ty::FnDef(def_id, substs) => tcx
ty::FnDef(def_id, substs) if tcx.sess.opts.debugging_opts.polymorphize => tcx
.normalize_erasing_regions(tcx.param_env(def_id), tcx.fn_sig(def_id))
.subst(tcx, substs),
ty::FnDef(def_id, substs) => tcx.fn_sig(def_id).subst(tcx, substs),
_ => unreachable!(),
};