From c660a51cc4db1f3e376abd0f324ff0426a2a5402 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Tue, 27 Apr 2021 13:16:39 +0900 Subject: [PATCH] Add a regression test for issue-84408 --- .../ui/const-generics/issues/issue-84408.rs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/test/ui/const-generics/issues/issue-84408.rs 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() {}