Add const-generics test.
This commit is contained in:
parent
be2641a61f
commit
72acd94117
2 changed files with 23 additions and 0 deletions
12
src/test/ui/traits/alias/self-in-const-generics.rs
Normal file
12
src/test/ui/traits/alias/self-in-const-generics.rs
Normal 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() {}
|
||||
11
src/test/ui/traits/alias/self-in-const-generics.stderr
Normal file
11
src/test/ui/traits/alias/self-in-const-generics.stderr
Normal 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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue