Change:
<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --code from <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
Heh, I guess wasn't fixed after all. I wonder when it regressed.
That label is for , I do not think it is the right one here.
cargo bisect rustc says this regressed in Perhaps ?
Untagging as a regression, this requires nightly (const generics).
The bug no longer needs the to trigger.

Discussion:
// relocations (we have an active `str` reference here). We don't use this // result to affect interpreter execution. let slice = data.inspect_with_uninit_and_ptr_outside_interpreter(start..end); <del> let s = std::str::from_utf8(slice).expect("non utf8 str from miri"); p!(write("{:?}", s)); </del> <ins> p!(write("{:?}", String::from_utf8_lossy(slice))); </ins> Ok(self) } (ConstValue::ByRef { alloc, offset }, ty::Array(t, n)) if *t == u8_type => {

+ // MIR for `main` after ConstProp fn main() -> () { <del> let mut _0: ();                      // return place in scope 0 at $DIR/invalid_constant.rs:13:11: 13:11 let _1: main::InvalidChar;           // in scope 0 at $DIR/invalid_constant.rs:19:9: 19:22 let mut _3: main::InvalidTag;        // in scope 0 at $DIR/invalid_constant.rs:26:25: 26:46 let mut _5: main::NoVariants;        // in scope 0 at $DIR/invalid_constant.rs:33:35: 33:56 </del> <ins> let mut _0: ();                      // return place in scope 0 at $DIR/invalid_constant.rs:15:11: 15:11 let _1: main::InvalidChar;           // in scope 0 at $DIR/invalid_constant.rs:21:9: 21:22 let mut _3: main::InvalidTag;        // in scope 0 at $DIR/invalid_constant.rs:28:25: 28:46 let mut _5: main::NoVariants;        // in scope 0 at $DIR/invalid_constant.rs:35:35: 35:56 </ins> scope 1 { <del> debug _invalid_char => _1;       // in scope 1 at $DIR/invalid_constant.rs:19:9: 19:22 let _2: [main::InvalidTag; 1];   // in scope 1 at $DIR/invalid_constant.rs:26:9: 26:21 </del> <ins> debug _invalid_char => _1;       // in scope 1 at $DIR/invalid_constant.rs:21:9: 21:22 let _2: [main::InvalidTag; 1];   // in scope 1 at $DIR/invalid_constant.rs:28:9: 28:21 </ins> scope 2 { <del> debug _invalid_tag => _2;    // in scope 2 at $DIR/invalid_constant.rs:26:9: 26:21 let _4: [main::NoVariants; 1]; // in scope 2 at $DIR/invalid_constant.rs:33:9: 33:31 </del> <ins> debug _invalid_tag => _2;    // in scope 2 at $DIR/invalid_constant.rs:28:9: 28:21 let _4: [main::NoVariants; 1]; // in scope 2 at $DIR/invalid_constant.rs:35:9: 35:31 </ins> scope 3 { <del> debug _enum_without_variants => _4; // in scope 3 at $DIR/invalid_constant.rs:33:9: 33:31 </del> <ins> debug _enum_without_variants => _4; // in scope 3 at $DIR/invalid_constant.rs:35:9: 35:31 let _6: main::Str<"���">; // in scope 3 at $DIR/invalid_constant.rs:39:9: 39:22 scope 4 { debug _non_utf8_str => _6; // in scope 4 at $DIR/invalid_constant.rs:39:9: 39:22 } </ins> } } } bb0: { <del> StorageLive(_1);                 // scope 0 at $DIR/invalid_constant.rs:19:9: 19:22 -         _1 = const { InvalidChar { int: 0x110001 } }; // scope 0 at $DIR/invalid_constant.rs:19:25: 19:64 +         _1 = const InvalidChar { int: 1114113_u32, chr: {transmute(0x00110001): char} }; // scope 0 at $DIR/invalid_constant.rs:19:25: 19:64 </del> <ins> StorageLive(_1);                 // scope 0 at $DIR/invalid_constant.rs:21:9: 21:22 -         _1 = const { InvalidChar { int: 0x110001 } }; // scope 0 at $DIR/invalid_constant.rs:21:25: 21:64 +         _1 = const InvalidChar { int: 1114113_u32, chr: {transmute(0x00110001): char} }; // scope 0 at $DIR/invalid_constant.rs:21:25: 21:64 </ins> // ty::Const // + ty: main::InvalidChar -                                          // + val: Unevaluated(main::{constant#0}, [main::InvalidChar], None) +                                          // + val: Value(Scalar(0x00110001)) // mir::Constant <del> // + span: $DIR/invalid_constant.rs:19:25: 19:64 </del> <ins> // + span: $DIR/invalid_constant.rs:21:25: 21:64 </ins> -                                          // + literal: Const { ty: main::InvalidChar, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(0:7 ~ invalid_constant[726d]::main::{constant#0}), const_param_did: None }, substs: [main::InvalidChar], promoted: None }) } +                                          // + literal: Const { ty: main::InvalidChar, val: Value(Scalar(0x00110001)) } <del> StorageLive(_2);                 // scope 1 at $DIR/invalid_constant.rs:26:9: 26:21 StorageLive(_3);                 // scope 1 at $DIR/invalid_constant.rs:26:25: 26:46 (_3.0: u32) = const 4_u32;       // scope 1 at $DIR/invalid_constant.rs:26:25: 26:46 -         _2 = [move _3];                  // scope 1 at $DIR/invalid_constant.rs:26:24: 26:47 +         _2 = [const InvalidTag { int: 4_u32, e: Scalar(0x00000004): E }]; // scope 1 at $DIR/invalid_constant.rs:26:24: 26:47 </del> <ins> StorageLive(_2);                 // scope 1 at $DIR/invalid_constant.rs:28:9: 28:21 StorageLive(_3);                 // scope 1 at $DIR/invalid_constant.rs:28:25: 28:46 (_3.0: u32) = const 4_u32;       // scope 1 at $DIR/invalid_constant.rs:28:25: 28:46 -         _2 = [move _3];                  // scope 1 at $DIR/invalid_constant.rs:28:24: 28:47 +         _2 = [const InvalidTag { int: 4_u32, e: Scalar(0x00000004): E }]; // scope 1 at $DIR/invalid_constant.rs:28:24: 28:47 </ins> +                                          // ty::Const +                                          // + ty: main::InvalidTag +                                          // + val: Value(Scalar(0x00000004)) +                                          // mir::Constant <del> +                                          // + span: $DIR/invalid_constant.rs:26:24: 26:47 </del> <ins> +                                          // + span: $DIR/invalid_constant.rs:28:24: 28:47 </ins> +                                          // + literal: Const { ty: main::InvalidTag, val: Value(Scalar(0x00000004)) } <del> StorageDead(_3);                 // scope 1 at $DIR/invalid_constant.rs:26:46: 26:47 StorageLive(_4);                 // scope 2 at $DIR/invalid_constant.rs:33:9: 33:31 StorageLive(_5);                 // scope 2 at $DIR/invalid_constant.rs:33:35: 33:56 (_5.0: u32) = const 0_u32;       // scope 2 at $DIR/invalid_constant.rs:33:35: 33:56 -         _4 = [move _5];                  // scope 2 at $DIR/invalid_constant.rs:33:34: 33:57 +         _4 = [const NoVariants { int: 0_u32, empty: Scalar(<ZST>): Empty }]; // scope 2 at $DIR/invalid_constant.rs:33:34: 33:57 </del> <ins> StorageDead(_3);                 // scope 1 at $DIR/invalid_constant.rs:28:46: 28:47 StorageLive(_4);                 // scope 2 at $DIR/invalid_constant.rs:35:9: 35:31 StorageLive(_5);                 // scope 2 at $DIR/invalid_constant.rs:35:35: 35:56 (_5.0: u32) = const 0_u32;       // scope 2 at $DIR/invalid_constant.rs:35:35: 35:56 -         _4 = [move _5];                  // scope 2 at $DIR/invalid_constant.rs:35:34: 35:57 +         _4 = [const NoVariants { int: 0_u32, empty: Scalar(<ZST>): Empty }]; // scope 2 at $DIR/invalid_constant.rs:35:34: 35:57 </ins> +                                          // ty::Const +                                          // + ty: main::NoVariants +                                          // + val: Value(Scalar(0x00000000)) +                                          // mir::Constant <del> +                                          // + span: $DIR/invalid_constant.rs:33:34: 33:57 </del> <ins> +                                          // + span: $DIR/invalid_constant.rs:35:34: 35:57 </ins> +                                          // + literal: Const { ty: main::NoVariants, val: Value(Scalar(0x00000000)) } <del> StorageDead(_5);                 // scope 2 at $DIR/invalid_constant.rs:33:56: 33:57 nop;                             // scope 0 at $DIR/invalid_constant.rs:13:11: 34:2 StorageDead(_4);                 // scope 2 at $DIR/invalid_constant.rs:34:1: 34:2 StorageDead(_2);                 // scope 1 at $DIR/invalid_constant.rs:34:1: 34:2 StorageDead(_1);                 // scope 0 at $DIR/invalid_constant.rs:34:1: 34:2 return;                          // scope 0 at $DIR/invalid_constant.rs:34:2: 34:2 </del> <ins> StorageDead(_5);                 // scope 2 at $DIR/invalid_constant.rs:35:56: 35:57 StorageLive(_6);                 // scope 3 at $DIR/invalid_constant.rs:39:9: 39:22 nop;                             // scope 0 at $DIR/invalid_constant.rs:15:11: 42:2 StorageDead(_6);                 // scope 3 at $DIR/invalid_constant.rs:42:1: 42:2 StorageDead(_4);                 // scope 2 at $DIR/invalid_constant.rs:42:1: 42:2 StorageDead(_2);                 // scope 1 at $DIR/invalid_constant.rs:42:1: 42:2 StorageDead(_1);                 // scope 0 at $DIR/invalid_constant.rs:42:1: 42:2 return;                          // scope 0 at $DIR/invalid_constant.rs:42:2: 42:2 </ins> } }

// Verify that we can pretty print invalid constants. <ins> #![feature(adt_const_params)] </ins> #![feature(inline_const)] <ins> #![allow(incomplete_features)] </ins> #[derive(Copy, Clone)] #[repr(u32)]

empty: Empty, } let _enum_without_variants = [NoVariants { int: 0 }]; <ins> // A non-UTF-8 string slice. Regression test for #75763 and #78520. struct Str<const S: &'static str>; let _non_utf8_str: Str::<{ unsafe { std::mem::transmute::<&[u8], &str>(&[0xC0, 0xC1, 0xF5]) } }>; </ins> }

<del> // ignore-test // FIXME(const_generics): This test causes an ICE after reverting #76030. #![feature(adt_const_params)] #![allow(incomplete_features)] struct Bug<const S: &'static str>; fn main() { let b: Bug::<{ unsafe { // FIXME(adt_const_params): Decide on how to deal with invalid values as const params. std::mem::transmute::<&[u8], &str>(&[0xC0, 0xC1, 0xF5]) } }>; } </del>