1
Fork 0

make subst_mir take EarlyBinder

This commit is contained in:
Kyle Matsuda 2023-04-14 10:11:01 -06:00
parent 82f57c16b7
commit e4f6b8b43b
2 changed files with 11 additions and 6 deletions

View file

@ -578,14 +578,15 @@ impl<'tcx> Instance<'tcx> {
self.def.has_polymorphic_mir_body().then_some(self.substs)
}
pub fn subst_mir<T>(&self, tcx: TyCtxt<'tcx>, v: &T) -> T
pub fn subst_mir<T>(&self, tcx: TyCtxt<'tcx>, v: EarlyBinder<&T>) -> T
where
T: TypeFoldable<TyCtxt<'tcx>> + Copy,
{
let v = v.map_bound(|v| *v);
if let Some(substs) = self.substs_for_mir_body() {
EarlyBinder(*v).subst(tcx, substs)
v.subst(tcx, substs)
} else {
*v
v.subst_identity()
}
}