Skip to content

Commit f22819b

Browse files
committedAug 12, 2022
Auto merge of #100456 - Dylan-DPC:rollup-fn17z9f, r=Dylan-DPC
Rollup of 9 pull requests Successful merges: - #100022 (Optimize thread ID generation) - #100030 (cleanup code w/ pointers in std a little) - #100229 (add -Zextra-const-ub-checks to enable more UB checking in const-eval) - #100247 (Generalize trait object generic param check to aliases.) - #100255 (Adding more verbose documentation for `std::fmt::Write`) - #100366 (errors: don't fail on broken primary translations) - #100396 (Suggest const and static for global variable) - #100409 (rustdoc: don't generate DOM element for operator) - #100443 (Add two let else regression tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
·
1.88.01.65.0
2 parents 0068b8b + 3bc30bb commit f22819b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+584
-258
lines changed
 

‎compiler/rustc_const_eval/src/const_eval/machine.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,16 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
236236

237237
const PANIC_ON_ALLOC_FAIL: bool = false; // will be raised as a proper error
238238

239+
#[inline(always)]
240+
fn enforce_alignment(ecx: &InterpCx<'mir, 'tcx, Self>) -> bool {
241+
ecx.tcx.sess.opts.unstable_opts.extra_const_ub_checks
242+
}
243+
244+
#[inline(always)]
245+
fn enforce_validity(ecx: &InterpCx<'mir, 'tcx, Self>) -> bool {
246+
ecx.tcx.sess.opts.unstable_opts.extra_const_ub_checks
247+
}
248+
239249
fn load_mir(
240250
ecx: &InterpCx<'mir, 'tcx, Self>,
241251
instance: ty::InstanceDef<'tcx>,

‎compiler/rustc_const_eval/src/interpret/machine.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -436,24 +436,12 @@ pub macro compile_time_machine(<$mir: lifetime, $tcx: lifetime>) {
436436
type AllocExtra = ();
437437
type FrameExtra = ();
438438

439-
#[inline(always)]
440-
fn enforce_alignment(_ecx: &InterpCx<$mir, $tcx, Self>) -> bool {
441-
// We do not check for alignment to avoid having to carry an `Align`
442-
// in `ConstValue::ByRef`.
443-
false
444-
}
445-
446439
#[inline(always)]
447440
fn force_int_for_alignment_check(_ecx: &InterpCx<$mir, $tcx, Self>) -> bool {
448441
// We do not support `force_int`.
449442
false
450443
}
451444

452-
#[inline(always)]
453-
fn enforce_validity(_ecx: &InterpCx<$mir, $tcx, Self>) -> bool {
454-
false // for now, we don't enforce validity
455-
}
456-
457445
#[inline(always)]
458446
fn enforce_number_init(_ecx: &InterpCx<$mir, $tcx, Self>) -> bool {
459447
true

0 commit comments

Comments
 (0)
Please sign in to comment.