1 #![feature(generic_const_exprs, adt_const_params, const_trait_impl)]
2 #![allow(incomplete_features)]
4 // test `N + N` unifies with explicit function calls for non-builtin-types
5 #[derive(PartialEq, Eq)]
8 impl const std::ops::Add for Foo {
11 fn add(self, rhs: Self) -> Self::Output {
16 struct Evaluatable<const N: Foo>;
18 fn foo<const N: Foo>(a: Evaluatable<{ N + N }>) {
19 bar::<{ std::ops::Add::add(N, N) }>();
22 fn bar<const N: Foo>() {}
24 // test that `N + N` unifies with explicit function calls for builin-types
25 struct Evaluatable2<const N: usize>;
27 fn foo2<const N: usize>(a: Evaluatable2<{ N + N }>) {
28 bar2::<{ std::ops::Add::add(N, N) }>();
29 //~^ error: unconstrained generic constant
30 // FIXME(generic_const_exprs) make this not an error
33 fn bar2<const N: usize>() {}