Monomorphize args while building Instance body

This commit is contained in:
Celina G. Val 2023-12-11 14:52:31 -08:00
parent 8a3765582c
commit 0a65dd305f

View File

@ -6,7 +6,7 @@
use crate::rustc_smir::{Stable, Tables}; use crate::rustc_smir::{Stable, Tables};
use rustc_middle::mir; use rustc_middle::mir;
use rustc_middle::mir::visit::MutVisitor; use rustc_middle::mir::visit::MutVisitor;
use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_middle::ty::{self, GenericArgsRef, Ty, TyCtxt};
/// Builds a monomorphic body for a given instance. /// Builds a monomorphic body for a given instance.
pub struct BodyBuilder<'tcx> { pub struct BodyBuilder<'tcx> {
@ -68,6 +68,10 @@ fn visit_constant(&mut self, constant: &mut mir::ConstOperand<'tcx>, location: m
self.super_constant(constant, location); self.super_constant(constant, location);
} }
fn visit_args(&mut self, args: &mut GenericArgsRef<'tcx>, _: mir::Location) {
*args = self.monomorphize(*args);
}
fn tcx(&self) -> TyCtxt<'tcx> { fn tcx(&self) -> TyCtxt<'tcx> {
self.tcx self.tcx
} }