about summary refs log tree commit diff
path: root/compiler/rustc_const_eval
diff options
context:
space:
mode:
authorJakob Degen <jakob.e.degen@gmail.com>2022-04-22 16:43:26 -0400
committerJakob Degen <jakob.e.degen@gmail.com>2022-04-22 16:45:15 -0400
commitae7d6facdaf2aab55e53e6d4b44003940819a27f (patch)
treed2f6ec640dbbdeecc79da6a23e80d8ea47adf69c /compiler/rustc_const_eval
parent5ffebc2cb3a089c27a4c7da13d09fd2365c288aa (diff)
downloadrust-ae7d6facdaf2aab55e53e6d4b44003940819a27f.tar.gz
rust-ae7d6facdaf2aab55e53e6d4b44003940819a27f.zip
Relax restrictions for copy operands
Diffstat (limited to 'compiler/rustc_const_eval')
-rw-r--r--compiler/rustc_const_eval/src/transform/validate.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs
index 79d427ccc44..f71bc586b48 100644
--- a/compiler/rustc_const_eval/src/transform/validate.rs
+++ b/compiler/rustc_const_eval/src/transform/validate.rs
@@ -214,7 +214,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
 
     fn visit_operand(&mut self, operand: &Operand<'tcx>, location: Location) {
         // This check is somewhat expensive, so only run it when -Zvalidate-mir is passed.
-        if self.tcx.sess.opts.debugging_opts.validate_mir {
+        if self.tcx.sess.opts.debugging_opts.validate_mir && self.mir_phase < MirPhase::DropsLowered
+        {
             // `Operand::Copy` is only supposed to be used with `Copy` types.
             if let Operand::Copy(place) = operand {
                 let ty = place.ty(&self.body.local_decls, self.tcx).ty;