about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBen Kimock <kimockb@gmail.com>2024-03-09 11:34:15 -0500
committerGitHub <noreply@github.com>2024-03-09 11:34:15 -0500
commit27cf4bb98516c801c8b24d80cd78cd5eee8edaff (patch)
tree351d7433fa58a8af661ca96dfc4eb06d2579a05c
parent50d0bea15384f1116afd6831de3cbdc8c154e677 (diff)
downloadrust-27cf4bb98516c801c8b24d80cd78cd5eee8edaff.tar.gz
rust-27cf4bb98516c801c8b24d80cd78cd5eee8edaff.zip
Only enable library UB checks in const-eval/Miri when debug_assertions are enabled
Co-authored-by: Ralf Jung <post@ralfj.de>
-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)