diff options
| author | Ralf Jung <post@ralfj.de> | 2024-03-17 10:29:02 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-03-23 18:45:05 +0100 |
| commit | 61775304200826b412f18fc87218161fb8a0dc5c (patch) | |
| tree | 43a2a658f42b2e50f03f8f09d1f970ebeef564a3 /compiler/rustc_const_eval/src/interpret | |
| parent | 987ef4c9221e792614a015a39b78f7d6a156c2f2 (diff) | |
refactor check_{lang,library}_ub: use a single intrinsic, put policy into library
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/step.rs | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs index 54bac70da38..9114ffff6fd 100644 --- a/compiler/rustc_const_eval/src/interpret/step.rs +++ b/compiler/rustc_const_eval/src/interpret/step.rs @@ -258,17 +258,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { let val = layout.offset_of_subfield(self, fields.iter()).bytes(); Scalar::from_target_usize(val, self) } - mir::NullOp::UbCheck(kind) => { - // We want to enable checks for library UB, because the interpreter doesn't - // know about those on its own. - // 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 => self.tcx.sess.opts.debug_assertions, - mir::UbKind::LanguageUb => false, - }; - Scalar::from_bool(should_check) - } + mir::NullOp::UbChecks => Scalar::from_bool(self.tcx.sess.opts.debug_assertions), }; self.write_scalar(val, &dest)?; } |
