diff options
| author | bors <bors@rust-lang.org> | 2022-05-25 06:14:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-05-25 06:14:15 +0000 |
| commit | cbdce423201f1b155c46f3ec690a644cf3b4ba53 (patch) | |
| tree | cef7952def48410cda70c688087adbb77b4974c8 /compiler/rustc_codegen_ssa/src | |
| parent | 9fadabc879e0b16214e8216c1a63a597d1d5d36b (diff) | |
| parent | 70bdfc1d799b84b05905397044c45da51d0c2661 (diff) | |
| download | rust-cbdce423201f1b155c46f3ec690a644cf3b4ba53.tar.gz rust-cbdce423201f1b155c46f3ec690a644cf3b4ba53.zip | |
Auto merge of #97382 - Dylan-DPC:rollup-2t4ov4z, r=Dylan-DPC
Rollup of 5 pull requests Successful merges: - #93604 (Make llvm-libunwind a per-target option) - #97026 (Change orderings of `Debug` for the Atomic types to `Relaxed`.) - #97105 (Add tests for lint on type dependent on consts) - #97323 (Introduce stricter checks for might_permit_raw_init under a debug flag ) - #97379 (Add aliases for `current_dir`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/block.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index f1007ba1578..03ef6d50d44 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs @@ -22,7 +22,7 @@ use rustc_span::source_map::Span; use rustc_span::{sym, Symbol}; use rustc_symbol_mangling::typeid_for_fnabi; use rustc_target::abi::call::{ArgAbi, FnAbi, PassMode}; -use rustc_target::abi::{self, HasDataLayout, WrappingRange}; +use rustc_target::abi::{self, HasDataLayout, InitKind, WrappingRange}; use rustc_target::spec::abi::Abi; /// Used by `FunctionCx::codegen_terminator` for emitting common patterns @@ -521,6 +521,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { source_info: mir::SourceInfo, target: Option<mir::BasicBlock>, cleanup: Option<mir::BasicBlock>, + strict_validity: bool, ) -> bool { // Emit a panic or a no-op for `assert_*` intrinsics. // These are intrinsics that compile to panics so that we can get a message @@ -543,8 +544,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let layout = bx.layout_of(ty); let do_panic = match intrinsic { Inhabited => layout.abi.is_uninhabited(), - ZeroValid => !layout.might_permit_raw_init(bx, /*zero:*/ true), - UninitValid => !layout.might_permit_raw_init(bx, /*zero:*/ false), + ZeroValid => !layout.might_permit_raw_init(bx, InitKind::Zero, strict_validity), + UninitValid => !layout.might_permit_raw_init(bx, InitKind::Uninit, strict_validity), }; if do_panic { let msg_str = with_no_visible_paths!({ @@ -678,6 +679,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { source_info, target, cleanup, + self.cx.tcx().sess.opts.debugging_opts.strict_init_checks, ) { return; } |
