diff --git a/src/test/ui/const-generics/issues/issue-84408.rs b/src/test/ui/const-generics/issues/issue-84408.rs new file mode 100644 index 00000000000..e1ba850a4c1 --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-84408.rs @@ -0,0 +1,38 @@ +// Regression test for #84408. +// check-pass + +#![feature(const_generics, const_evaluatable_checked)] +#![allow(incomplete_features)] + +trait Melon { + fn new(arr: [i32; X]) -> Self; + fn change>(self) -> T; +} + +struct Foo([i32; 5]); +struct Bar([i32; A + B]) +where + [(); A + B]: ; + +impl Melon<5> for Foo { + fn new(arr: [i32; 5]) -> Self { + Foo(arr) + } + fn change>(self) -> T { + T::new(self.0) + } +} + +impl Melon<{ A + B }> for Bar +where + [(); A + B]: , +{ + fn new(arr: [i32; A + B]) -> Self { + Bar(arr) + } + fn change>(self) -> T { + T::new(self.0) + } +} + +fn main() {}