diff options
| author | Ralf Jung <post@ralfj.de> | 2020-03-13 08:43:27 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2020-03-13 08:43:27 +0100 |
| commit | f61fb53af40daf55764f2f2644604fd22498cb13 (patch) | |
| tree | 8108f48e1c8a953adc881279632406244686877c | |
| parent | f32cccc05e8c47ed799a99d06dbfb1571fa6908c (diff) | |
| download | rust-f61fb53af40daf55764f2f2644604fd22498cb13.tar.gz rust-f61fb53af40daf55764f2f2644604fd22498cb13.zip | |
adjust enum naming
| -rw-r--r-- | src/librustc_codegen_ssa/mir/block.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index eef06c35794..798d22ccd76 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -453,34 +453,34 @@ 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 AssertIntrinsic { + Inhabited, + ZeroValid, + UninitValid, }; let panic_intrinsic = intrinsic.and_then(|i| match i { // FIXME: Move to symbols instead of strings. - "assert_inhabited" => Some(PanicIntrinsic::IfUninhabited), - "assert_zero_valid" => Some(PanicIntrinsic::IfZeroInvalid), - "assert_uninit_valid" => Some(PanicIntrinsic::IfAnyInvalid), + "assert_inhabited" => Some(AssertIntrinsic::Inhabited), + "assert_zero_valid" => Some(AssertIntrinsic::ZeroValid), + "assert_uninit_valid" => Some(AssertIntrinsic::UninitValid), _ => None, }); if let Some(intrinsic) = panic_intrinsic { - use PanicIntrinsic::*; + use AssertIntrinsic::*; let ty = instance.unwrap().substs.type_at(0); let layout = bx.layout_of(ty); let do_panic = match intrinsic { - IfUninhabited => layout.abi.is_uninhabited(), + Inhabited => layout.abi.is_uninhabited(), // We unwrap as the error type is `!`. - IfZeroInvalid => !layout.might_permit_raw_init(bx, /*zero:*/ true).unwrap(), + ZeroValid => !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(), + UninitValid => !layout.might_permit_raw_init(bx, /*zero:*/ false).unwrap(), }; if do_panic { let msg_str = if layout.abi.is_uninhabited() { // Use this error even for the other intrinsics as it is more precise. format!("attempted to instantiate uninhabited type `{}`", ty) - } else if intrinsic == IfZeroInvalid { + } else if intrinsic == ZeroValid { format!("attempted to zero-initialize type `{}`, which is invalid", ty) } else { format!("attempted to leave type `{}` uninitialized, which is invalid", ty) |
