Change:
<ins> // check-pass #![feature(inline_const, generic_const_exprs)] #![allow(incomplete_features)] use std::marker::PhantomData; pub struct Equal<const T: usize, const R: usize>(); pub trait True {} impl<const T: usize> True for Equal<T, T> {} // replacement for generativity pub struct Id<'id>(PhantomData<fn(&'id ()) -> &'id ()>); pub struct Guard<'id>(Id<'id>); fn make_guard<'id>(i: &'id Id<'id>) -> Guard<'id> { Guard(Id(PhantomData)) } impl<'id> Into<Id<'id>> for Guard<'id> { fn into(self) -> Id<'id> { self.0 } } pub struct Arena<'life> { bytes: *mut [u8], //bitmap: RefCell<RoaringBitmap>, _token: PhantomData<Id<'life>>, } #[repr(transparent)] pub struct Item<'life, T> { data: T, _phantom: PhantomData<Id<'life>>, } #[repr(transparent)] pub struct Token<'life, 'borrow, 'compact, 'reborrow, T> where 'life: 'reborrow, T: Tokenize<'life, 'borrow, 'compact, 'reborrow>, { //ptr: *mut <T as Tokenize>::Tokenized, ptr: core::ptr::NonNull<T::Tokenized>, _phantom: PhantomData<Id<'life>>, _compact: PhantomData<&'borrow Guard<'compact>>, _result: PhantomData<&'reborrow T::Untokenized>, } impl<'life> Arena<'life> { pub fn tokenize<'before, 'compact, 'borrow, 'reborrow, T, U>( &self, guard: &'borrow Guard<'compact>, item: Item<'life, &'before mut T>, ) -> Token<'life, 'borrow, 'compact, 'reborrow, U> where T: Tokenize<'life, 'borrow, 'compact, 'reborrow, Untokenized = U>, T::Untokenized: Tokenize<'life, 'borrow, 'compact, 'reborrow>, Equal<{ core::mem::size_of::<T>() }, { core::mem::size_of::<U>() }>: True, 'compact: 'borrow, 'life: 'reborrow, 'life: 'compact, 'life: 'borrow, // 'borrow: 'before ?? { let dst = item.data as *mut T as *mut T::Tokenized; Token { ptr: core::ptr::NonNull::new(dst as *mut _).unwrap(), _phantom: PhantomData, _compact: PhantomData, _result: PhantomData, } } } pub trait Tokenize<'life, 'borrow, 'compact, 'reborrow> where 'compact: 'borrow, 'life: 'reborrow, 'life: 'borrow, 'life: 'compact, { type Tokenized; type Untokenized; const TO: fn(&Arena<'life>, &'borrow Guard<'compact>, Self) -> Self::Tokenized; const FROM: fn(&'reborrow Arena<'life>, Self::Tokenized) -> Self::Untokenized; } macro_rules! tokenize { ($to:expr, $from:expr) => { const TO: fn(&Arena<'life>, &'borrow Guard<'compact>, Self) -> Self::Tokenized = $to; const FROM: fn(&'reborrow Arena<'life>, Self::Tokenized) -> Self::Untokenized = $from; }; } struct Foo<'life, 'borrow>(Option<Item<'life, &'borrow mut Bar>>); struct TokenFoo<'life, 'borrow, 'compact, 'reborrow>( Option<Token<'life, 'borrow, 'compact, 'reborrow, Bar>>, ); struct Bar(u8); impl<'life, 'before, 'borrow, 'compact, 'reborrow> Tokenize<'life, 'borrow, 'compact, 'reborrow> for Foo<'life, 'before> where 'compact: 'borrow, 'life: 'reborrow, 'life: 'borrow, 'life: 'compact, { type Tokenized = TokenFoo<'life, 'borrow, 'compact, 'reborrow>; type Untokenized = Foo<'life, 'reborrow>; tokenize!(foo_to, foo_from); } impl<'life, 'borrow, 'compact, 'reborrow> Tokenize<'life, 'borrow, 'compact, 'reborrow> for Bar where 'compact: 'borrow, 'life: 'reborrow, 'life: 'borrow, 'life: 'compact, { type Tokenized = Bar; type Untokenized = Bar; tokenize!(bar_to, bar_from); } fn bar_to<'life, 'borrow, 'compact>( arena: &Arena<'life>, guard: &'borrow Guard<'compact>, s: Bar, ) -> Bar { s } fn bar_from<'life, 'reborrow>(arena: &'reborrow Arena<'life>, s: Bar) -> Bar { s } fn foo_to<'life, 'borrow, 'compact, 'reborrow, 'before>( arena: &'before Arena<'life>, guard: &'borrow Guard<'compact>, s: Foo<'life, 'before>, ) -> TokenFoo<'life, 'borrow, 'compact, 'reborrow> { let Foo(bar) = s; TokenFoo(bar.map(|bar| arena.tokenize(guard, bar))) } fn foo_from<'life, 'borrow, 'compact, 'reborrow>( arena: &'reborrow Arena<'life>, s: TokenFoo<'life, 'borrow, 'compact, 'reborrow>, ) -> Foo<'life, 'reborrow> { Foo(s.0.map(|bar| panic!())) } fn main() {} </ins>

Discussion:
<!-- 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. --<!-- 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</detailsThis occurred in code different from the above but this is a minimal example that causes this failure. I believe I am disobeying some rules in the manner in which is not bound in the underlying type of the trait. This bug appeared in my own code that worked with a previous nightly build. That code does bind into the underlying type and still fails. If I bind it in this example with the following changes: the error goes away. I will need to create a minimal example that produces an ICE closer to the failure in my own code but I was struggling to do this. This is at least one ICE of interest and perhaps the unbound should itself be prevented. I'm not entirely sure. Worthy of note, the following also compiles fine: which omits all of the stuff.
I've isolated it to the following commit range: ..
I determined it was due to the above linked-from PR.
Prior to this PR, the above code would emit the following warning instead of generating the ICE:
This is caused by the fact that acts sort of like a const item with a const param ty the references other generic parameters: . When we relate the in we constrain infer vars to be the same as eachother but do not end up actually resolving the infer vars before relating so the assertion that const param ty's are sees two different infer vars instead of the resolved ones.