Skip to content

Commit

Permalink
Prevent polymorphic const prop on assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Dec 26, 2019
1 parent 652cec1 commit 3ab0663
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/librustc_mir/transform/const_prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,13 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
_ => {}
}

// `eval_rvalue_into_place` uses `Instance::resolve` for constants which still has a bug
// (#66901) in the presence of trait items with a default body. So we just bail out if we
// aren't 100% monomorphic.
if rvalue.needs_subst() {
return None;
}

self.use_ecx(source_info, |this| {
trace!("calling eval_rvalue_into_place(rvalue = {:?}, place = {:?})", rvalue, place);
this.ecx.eval_rvalue_into_place(rvalue, place)?;
Expand Down

0 comments on commit 3ab0663

Please sign in to comment.