about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2019-12-26 17:28:07 +0100
committerOliver Scherer <github35764891676564198441@oli-obk.de>2019-12-28 00:22:16 +0100
commitb3abebd78dcab1cadf7535271ff2ac6188b33cb8 (patch)
tree0741285fae359bd788f15563fbda29b1155065f3
parent3eb0585173deb61ed0ed3e15fad360882d894568 (diff)
downloadrust-b3abebd78dcab1cadf7535271ff2ac6188b33cb8.tar.gz
rust-b3abebd78dcab1cadf7535271ff2ac6188b33cb8.zip
Prevent polymorphic const prop on assignments
-rw-r--r--src/librustc_mir/transform/const_prop.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs
index bf8e63ebe3d..206f8043786 100644
--- a/src/librustc_mir/transform/const_prop.rs
+++ b/src/librustc_mir/transform/const_prop.rs
@@ -570,6 +570,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)?;