Skip to content

Commit b3abebd

Browse files
committed
Prevent polymorphic const prop on assignments
1 parent 3eb0585 commit b3abebd

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
@@ -570,6 +570,13 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
570570
_ => {}
571571
}
572572

573+
// `eval_rvalue_into_place` uses `Instance::resolve` for constants which still has a bug
574+
// (#66901) in the presence of trait items with a default body. So we just bail out if we
575+
// aren't 100% monomorphic.
576+
if rvalue.needs_subst() {
577+
return None;
578+
}
579+
573580
self.use_ecx(source_info, |this| {
574581
trace!("calling eval_rvalue_into_place(rvalue = {:?}, place = {:?})", rvalue, place);
575582
this.ecx.eval_rvalue_into_place(rvalue, place)?;

0 commit comments

Comments
 (0)