diff options
| author | Ralf Jung <post@ralfj.de> | 2020-02-16 22:45:28 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2020-02-29 09:27:25 +0100 |
| commit | 6e66f586a0da51fbd4cafa2e1da914cf07c65503 (patch) | |
| tree | 4e65c97a4ca68a93666a564a9b6b0f8c520a34f5 /src/librustc_codegen_ssa | |
| parent | b133d6776fde22e944eb7f266ee165ffcf7cdb09 (diff) | |
| download | rust-6e66f586a0da51fbd4cafa2e1da914cf07c65503.tar.gz rust-6e66f586a0da51fbd4cafa2e1da914cf07c65503.zip | |
fmt
Diffstat (limited to 'src/librustc_codegen_ssa')
| -rw-r--r-- | src/librustc_codegen_ssa/mir/block.rs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index ae3d8442add..7c5a17d43b6 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -524,13 +524,17 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { // These are intrinsics that compile to panics so that we can get a message // which mentions the offending type, even from a const context. #[derive(Debug, PartialEq)] - enum PanicIntrinsic { IfUninhabited, IfZeroInvalid, IfAnyInvalid }; + enum PanicIntrinsic { + IfUninhabited, + IfZeroInvalid, + IfAnyInvalid, + }; let panic_intrinsic = intrinsic.and_then(|i| match i { // FIXME: Move to symbols instead of strings. "panic_if_uninhabited" => Some(PanicIntrinsic::IfUninhabited), "panic_if_zero_invalid" => Some(PanicIntrinsic::IfZeroInvalid), "panic_if_any_invalid" => Some(PanicIntrinsic::IfAnyInvalid), - _ => None + _ => None, }); if let Some(intrinsic) = panic_intrinsic { use PanicIntrinsic::*; @@ -538,10 +542,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let layout = bx.layout_of(ty); let do_panic = match intrinsic { IfUninhabited => layout.abi.is_uninhabited(), - IfZeroInvalid => // We unwrap as the error type is `!`. - !layout.might_permit_raw_init(&bx, /*zero:*/ true).unwrap(), - IfAnyInvalid => // We unwrap as the error type is `!`. - !layout.might_permit_raw_init(&bx, /*zero:*/ false).unwrap(), + // We unwrap as the error type is `!`. + IfZeroInvalid => !layout.might_permit_raw_init(&bx, /*zero:*/ true).unwrap(), + // We unwrap as the error type is `!`. + IfAnyInvalid => !layout.might_permit_raw_init(&bx, /*zero:*/ false).unwrap(), }; if do_panic { let msg_str = if layout.abi.is_uninhabited() { |
