about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <eddyb@lyken.rs>2021-08-25 18:05:10 +0300
committerEduard-Mihai Burtescu <eddyb@lyken.rs>2021-08-30 00:44:09 +0300
commit8e6d126b7d69281072f16dcc3cfff140e8947c58 (patch)
tree293ebfbe26edb8e4baf22cec93eb517f2f1c6714 /compiler/rustc_codegen_ssa/src
parent87d1fb747f8ed3dde3cd36c17d1ef735872a7bf9 (diff)
downloadrust-8e6d126b7d69281072f16dcc3cfff140e8947c58.tar.gz
rust-8e6d126b7d69281072f16dcc3cfff140e8947c58.zip
rustc_target: `TyAndLayout::field` should never error.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/block.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs
index 673d348a2a8..2a76ad0fb13 100644
--- a/compiler/rustc_codegen_ssa/src/mir/block.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/block.rs
@@ -472,10 +472,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(),
-                // We unwrap as the error type is `!`.
-                ZeroValid => !layout.might_permit_raw_init(bx, /*zero:*/ true).unwrap(),
-                // We unwrap as the error type is `!`.
-                UninitValid => !layout.might_permit_raw_init(bx, /*zero:*/ false).unwrap(),
+                ZeroValid => !layout.might_permit_raw_init(bx, /*zero:*/ true),
+                UninitValid => !layout.might_permit_raw_init(bx, /*zero:*/ false),
             };
             if do_panic {
                 let msg_str = with_no_trimmed_paths(|| {