Change:
I found this ICE while playing with const generics on the Rust playground. () : <details<summary<strongBacktrace</strong</summary<p</p</details
Ah, it looks like that feature enables extra behavior for s.
glacier ""
This ICEs since modify labels: +regression-from-stable-to-stable
This seems to need unstable features to reproduce? Or did I miss something?
You can reproduce the ICE on stable, but to actually use the code you need to be on nightly. I think makes sense here.
Oh, so you need the feature gates, but you can still reproduce it on stable, got it. In that case it is technically not since you can reproduce the ICE on stable.
Assigning and removing as in the prioritization working group.
would fix the ICE. To me it looks as if the problem is that the bound is not satisfied in this example, but we get a really confusing error message now: I suggest we'd close this issue and open a new diagnostics issue in case the PR would be merged.

Discussion:
<ins> #![feature(const_fn_trait_bound, generic_const_exprs)] #![allow(incomplete_features)] trait MiniTypeId { const TYPE_ID: u64; } impl<T> MiniTypeId for T { const TYPE_ID: u64 = 0; } enum Lift<const V: bool> {} trait IsFalse {} impl IsFalse for Lift<false> {} const fn is_same_type<T: MiniTypeId, U: MiniTypeId>() -> bool { T::TYPE_ID == U::TYPE_ID } fn requires_distinct<A, B>(_a: A, _b: B) where A: MiniTypeId, B: MiniTypeId, Lift<{is_same_type::<A, B>()}>: IsFalse {} fn main() { requires_distinct("str", 12); //~^ ERROR mismatched types } </ins>

<ins> error[E0308]: mismatched types --> $DIR/issue-79674.rs:26:5 | LL |     requires_distinct("str", 12); |     ^^^^^^^^^^^^^^^^^ expected `true`, found `false` | = note: expected type `true` found type `false` error: aborting due to previous error For more information about this error, try `rustc --explain E0308`. </ins>

<ins> #![feature(generic_const_exprs)] #![allow(incomplete_features)] trait TensorDimension { const DIM : usize; const ISSCALAR : bool = Self::DIM == 0; fn is_scalar(&self) -> bool {Self::ISSCALAR} } trait TensorSize : TensorDimension { fn size(&self) -> [usize;Self::DIM]; fn inbounds(&self,index : [usize;Self::DIM]) -> bool { index.iter().zip(self.size().iter()).all(|(i,s)| i < s) } } trait Broadcastable: TensorSize + Sized { type Element; fn bget(&self, index:[usize;Self::DIM]) -> Option<Self::Element>; fn lazy_updim<const NEWDIM : usize>(&self, size : [usize;NEWDIM] ) -> LazyUpdim<Self,{Self::DIM},NEWDIM> { assert!(NEWDIM >= Self::DIM, "Updimmed tensor cannot have fewer indices than the initial one."); LazyUpdim {size,reference:&self} } fn bmap<T,F :Fn(Self::Element) -> T>(&self,foo : F) -> BMap<T,Self,F,{Self::DIM}>{ BMap {reference:self,closure : foo} } } struct LazyUpdim<'a,T : Broadcastable,const OLDDIM : usize, const DIM : usize> { size : [usize;DIM], reference : &'a T } impl<'a,T : Broadcastable,const DIM : usize> TensorDimension for LazyUpdim<'a,T,{T::DIM},DIM> { const DIM : usize = DIM; } impl<'a,T : Broadcastable,const DIM : usize> TensorSize for LazyUpdim<'a,T,{T::DIM},DIM> { fn size(&self) -> [usize;DIM] {self.size} //~^ ERROR method not compatible with trait } impl<'a,T : Broadcastable,const DIM : usize>  Broadcastable for LazyUpdim<'a,T,{T::DIM},DIM> { type Element = T::Element; fn bget(&self,index:[usize;DIM]) -> Option<Self::Element> { //~^ ERROR method not compatible with trait assert!(DIM >= T::DIM); if !self.inbounds(index) {return None} //~^ ERROR unconstrained generic constant //~| ERROR mismatched types let size = self.size(); //~^ ERROR unconstrained generic constant let newindex : [usize;T::DIM] = Default::default(); //~^ ERROR the trait bound `[usize; _]: Default` is not satisfied self.reference.bget(newindex) } } struct BMap<'a,R, T : Broadcastable, F :  Fn(T::Element) -> R  , const DIM: usize> { reference : &'a T, closure : F } impl<'a,R, T : Broadcastable, F :  Fn(T::Element) -> R, const DIM: usize> TensorDimension for BMap<'a,R,T,F,DIM> { const DIM : usize = DIM; } impl<'a,R, T : Broadcastable, F :  Fn(T::Element) -> R  , const DIM: usize> TensorSize for BMap<'a,R,T,F,DIM> { fn size(&self) -> [usize;DIM] {self.reference.size()} //~^ ERROR unconstrained generic constant //~| ERROR mismatched types //~| ERROR method not compatible with trait } impl<'a,R, T : Broadcastable, F :  Fn(T::Element) -> R  , const DIM: usize> Broadcastable for BMap<'a,R,T,F,DIM> { type Element = R; fn bget(&self,index:[usize;DIM]) -> Option<Self::Element> { //~^ ERROR method not compatible with trait self.reference.bget(index).map(&self.closure) //~^ ERROR unconstrained generic constant //~| ERROR mismatched types } } impl<T> TensorDimension for Vec<T> { const DIM : usize = 1; } impl<T> TensorSize for Vec<T> { fn size(&self) -> [usize;1] {[self.len()]} } impl<T: Clone> Broadcastable for Vec<T> { type Element = T; fn bget(& self,index : [usize;1]) -> Option<T> { self.get(index[0]).cloned() } } fn main() { let v = vec![1,2,3]; let bv = v.lazy_updim([3,4]); let bbv = bv.bmap(|x| x*x); println!("The size of v is {:?}",bbv.bget([0,2]).expect("Out of bounds.")); } </ins>

<ins> error[E0308]: method not compatible with trait --> $DIR/issue-83765.rs:44:5 | LL |     fn size(&self) -> [usize;DIM] {self.size} |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Self::DIM`, found `DIM` | = note: expected type `Self::DIM` found type `DIM` error[E0308]: method not compatible with trait --> $DIR/issue-83765.rs:51:5 | LL |     fn bget(&self,index:[usize;DIM]) -> Option<Self::Element> { |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Self::DIM`, found `DIM` | = note: expected type `Self::DIM` found type `DIM` error[E0308]: method not compatible with trait --> $DIR/issue-83765.rs:78:5 | LL |     fn size(&self) -> [usize;DIM] {self.reference.size()} |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Self::DIM`, found `DIM` | = note: expected type `Self::DIM` found type `DIM` error[E0308]: method not compatible with trait --> $DIR/issue-83765.rs:88:5 | LL |     fn bget(&self,index:[usize;DIM]) -> Option<Self::Element> { |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Self::DIM`, found `DIM` | = note: expected type `Self::DIM` found type `DIM` error: unconstrained generic constant --> $DIR/issue-83765.rs:54:18 | LL |         if !self.inbounds(index) {return None} |                  ^^^^^^^^ | = help: try adding a `where` bound using this expression: `where [(); Self::DIM]:` note: required by a bound in `TensorSize::inbounds` --> $DIR/issue-83765.rs:12:38 | LL |     fn inbounds(&self,index : [usize;Self::DIM]) -> bool { |                                      ^^^^^^^^^ required by this bound in `TensorSize::inbounds` error[E0308]: mismatched types --> $DIR/issue-83765.rs:54:27 | LL |         if !self.inbounds(index) {return None} |                           ^^^^^ expected `Self::DIM`, found `DIM` | = note: expected type `Self::DIM` found type `DIM` error: unconstrained generic constant --> $DIR/issue-83765.rs:57:25 | LL |         let size = self.size(); |                         ^^^^ | = help: try adding a `where` bound using this expression: `where [(); Self::DIM]:` note: required by a bound in `TensorSize::size` --> $DIR/issue-83765.rs:11:30 | LL |     fn size(&self) -> [usize;Self::DIM]; |                              ^^^^^^^^^ required by this bound in `TensorSize::size` error[E0277]: the trait bound `[usize; _]: Default` is not satisfied --> $DIR/issue-83765.rs:59:41 | LL |         let newindex : [usize;T::DIM] = Default::default(); |                                         ^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `[usize; _]` | help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement | LL | impl<'a,T : Broadcastable,const DIM : usize>  Broadcastable for LazyUpdim<'a,T,{T::DIM},DIM> where [usize; _]: Default |                                                                                              +++++++++++++++++++++++++ error: unconstrained generic constant --> $DIR/issue-83765.rs:78:51 | LL |     fn size(&self) -> [usize;DIM] {self.reference.size()} |                                                   ^^^^ | = help: try adding a `where` bound using this expression: `where [(); Self::DIM]:` note: required by a bound in `TensorSize::size` --> $DIR/issue-83765.rs:11:30 | LL |     fn size(&self) -> [usize;Self::DIM]; |                              ^^^^^^^^^ required by this bound in `TensorSize::size` error[E0308]: mismatched types --> $DIR/issue-83765.rs:78:36 | LL |     fn size(&self) -> [usize;DIM] {self.reference.size()} |                                    ^^^^^^^^^^^^^^^^^^^^^ expected `DIM`, found `Self::DIM` | = note: expected type `DIM` found type `Self::DIM` error: unconstrained generic constant --> $DIR/issue-83765.rs:90:24 | LL |         self.reference.bget(index).map(&self.closure) |                        ^^^^ | = help: try adding a `where` bound using this expression: `where [(); Self::DIM]:` note: required by a bound in `Broadcastable::bget` --> $DIR/issue-83765.rs:20:33 | LL |     fn bget(&self, index:[usize;Self::DIM]) -> Option<Self::Element>; |                                 ^^^^^^^^^ required by this bound in `Broadcastable::bget` error[E0308]: mismatched types --> $DIR/issue-83765.rs:90:29 | LL |         self.reference.bget(index).map(&self.closure) |                             ^^^^^ expected `Self::DIM`, found `DIM` | = note: expected type `Self::DIM` found type `DIM` error: aborting due to 12 previous errors Some errors have detailed explanations: E0277, E0308. For more information about an error, try `rustc --explain E0277`. </ins>

<ins> // check-pass #![feature(generic_const_exprs)] #![allow(incomplete_features)] pub trait IsTrue<const T: bool> {} impl IsTrue<true> for () {} pub trait IsZST {} impl<T> IsZST for T where (): IsTrue<{ std::mem::size_of::<T>() == 0 }> {} fn _func() -> impl IsZST { || {} } fn main() {} </ins>

<ins> // check-pass #![allow(incomplete_features)] #![feature(generic_const_exprs)] pub struct Assert<const COND: bool>(); pub trait IsTrue {} impl IsTrue for Assert<true> {} pub trait IsNotZST {} impl<T> IsNotZST for T where Assert<{ std::mem::size_of::<T>() > 0 }>: IsTrue {} fn main() {} </ins>

<ins> #![feature(const_type_id)] #![feature(generic_const_exprs)] #![feature(core_intrinsics)] #![allow(incomplete_features)] use std::any::TypeId; struct If<const B: bool>; pub trait True {} impl True for If<true> {} fn consume<T: 'static>(_val: T) where If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True, //~^ ERROR: overly complex generic constant //~| ERROR: calls in constants are limited to constant functions { } fn test<T: 'static>() where If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True, //~^ ERROR: overly complex generic constant //~| ERROR: calls in constants are limited to constant functions { } fn main() { let a = (); consume(0i32); consume(a); } </ins>

<ins> error: overly complex generic constant --> $DIR/issue-90318.rs:14:8 | LL |     If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True, |        ^^-----------------^^^^^^^^^^^^^^^^^^^^^^^^ |          | |          borrowing is not supported in generic constants | = help: consider moving this anonymous constant into a `const` function = note: this operation may be supported in the future error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants --> $DIR/issue-90318.rs:14:10 | LL |     If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True, |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: overly complex generic constant --> $DIR/issue-90318.rs:22:8 | LL |     If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True, |        ^^-----------------^^^^^^^^^^^^^^^^^^^^^^^^ |          | |          borrowing is not supported in generic constants | = help: consider moving this anonymous constant into a `const` function = note: this operation may be supported in the future error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants --> $DIR/issue-90318.rs:22:10 | LL |     If<{ TypeId::of::<T>() != TypeId::of::<()>() }>: True, |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0015`. </ins>