Add a regression test for an ICE when using `impl Trait` with a const generic bound
diff --git a/tests/ui/const-generics/generic_const_exprs/ice-wrapper-impl-trait-with-const-bound-118278.rs b/tests/ui/const-generics/generic_const_exprs/ice-wrapper-impl-trait-with-const-bound-118278.rs new file mode 100644 index 0000000..02dff02 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/ice-wrapper-impl-trait-with-const-bound-118278.rs
@@ -0,0 +1,28 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/118278 + +//@ check-pass + +#![allow(incomplete_features)] +#![feature(generic_const_exprs)] + +pub trait Foo { + const SIZE: usize; +} + +impl Foo for u64 { + const SIZE: usize = 8; +} + +pub struct Wrapper<T> +where + T: Foo, + [(); T::SIZE]:, +{ + pub t: T, +} + +pub fn bar() -> Wrapper<impl Foo> { + Wrapper { t: 10 } +} + +fn main() {}