Add const-generics test.

This commit is contained in:
Camille GILLOT 2022-08-17 21:50:59 +02:00
parent be2641a61f
commit 72acd94117
2 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1,12 @@
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]
#![feature(trait_alias)]
trait Bar<const N: usize> {}
trait BB = Bar<{ 2 + 1 }>;
fn foo(x: &dyn BB) {}
//~^ ERROR the trait alias `BB` cannot be made into an object [E0038]
fn main() {}

View file

@ -0,0 +1,11 @@
error[E0038]: the trait alias `BB` cannot be made into an object
--> $DIR/self-in-const-generics.rs:9:16
|
LL | fn foo(x: &dyn BB) {}
| ^^
|
= note: it cannot use `Self` as a type parameter in a supertrait or `where`-clause
error: aborting due to previous error
For more information about this error, try `rustc --explain E0038`.