Skip to content

Commit 3ab0663

Browse files
committed
Prevent polymorphic const prop on assignments
1 parent 652cec1 commit 3ab0663

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/librustc_mir/transform/const_prop.rs

+7
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,13 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
562562
_ => {}
563563
}
564564

565+
// `eval_rvalue_into_place` uses `Instance::resolve` for constants which still has a bug
566+
// (#66901) in the presence of trait items with a default body. So we just bail out if we
567+
// aren't 100% monomorphic.
568+
if rvalue.needs_subst() {
569+
return None;
570+
}
571+
565572
self.use_ecx(source_info, |this| {
566573
trace!("calling eval_rvalue_into_place(rvalue = {:?}, place = {:?})", rvalue, place);
567574
this.ecx.eval_rvalue_into_place(rvalue, place)?;

0 commit comments

Comments
 (0)