Skip to content

Commit

Permalink
Add const-generics test.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Aug 17, 2022
1 parent be2641a commit 72acd94
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/ui/traits/alias/self-in-const-generics.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 11 additions & 0 deletions src/test/ui/traits/alias/self-in-const-generics.stderr
Original file line number Diff line number Diff line change
@@ -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`.

0 comments on commit 72acd94

Please sign in to comment.