1
Fork 0

add test for builtin types N + N unifying with fn call

This commit is contained in:
Ellen 2021-09-09 15:43:59 +01:00
parent fd9bb30ab8
commit 8295e4a6cf
4 changed files with 33 additions and 5 deletions

View file

@ -1,7 +1,7 @@
// check-pass
#![feature(generic_const_exprs, adt_const_params, const_trait_impl)]
#![allow(incomplete_features)]
// test `N + N` unifies with explicit function calls for non-builtin-types
#[derive(PartialEq, Eq)]
struct Foo(u8);
@ -21,4 +21,15 @@ fn foo<const N: Foo>(a: Evaluatable<{ N + N }>) {
fn bar<const N: Foo>() {}
// test that `N + N` unifies with explicit function calls for builin-types
struct Evaluatable2<const N: usize>;
fn foo2<const N: usize>(a: Evaluatable2<{ N + N }>) {
bar2::<{ std::ops::Add::add(N, N) }>();
//~^ error: unconstrained generic constant
// FIXME(generic_const_exprs) make this not an error
}
fn bar2<const N: usize>() {}
fn main() {}