about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_const_eval/src/interpret/step.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs
index 752fdc2c6f8..54bac70da38 100644
--- a/compiler/rustc_const_eval/src/interpret/step.rs
+++ b/compiler/rustc_const_eval/src/interpret/step.rs
@@ -264,7 +264,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
                         // But we want to disable checks for language UB, because the interpreter
                         // has its own better checks for that.
                         let should_check = match kind {
-                            mir::UbKind::LibraryUb => true,
+                            mir::UbKind::LibraryUb => self.tcx.sess.opts.debug_assertions,
                             mir::UbKind::LanguageUb => false,
                         };
                         Scalar::from_bool(should_check)