From 0a65dd305f06fa32eaa494db74c40f5d8616a2e2 Mon Sep 17 00:00:00 2001 From: "Celina G. Val" Date: Mon, 11 Dec 2023 14:52:31 -0800 Subject: [PATCH] Monomorphize args while building Instance body --- compiler/rustc_smir/src/rustc_smir/builder.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_smir/src/rustc_smir/builder.rs b/compiler/rustc_smir/src/rustc_smir/builder.rs index 7e74a1d92c7..039bdec4c78 100644 --- a/compiler/rustc_smir/src/rustc_smir/builder.rs +++ b/compiler/rustc_smir/src/rustc_smir/builder.rs @@ -6,7 +6,7 @@ use crate::rustc_smir::{Stable, Tables}; use rustc_middle::mir; 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. 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); } + fn visit_args(&mut self, args: &mut GenericArgsRef<'tcx>, _: mir::Location) { + *args = self.monomorphize(*args); + } + fn tcx(&self) -> TyCtxt<'tcx> { self.tcx }