Skip to content

Commit

Permalink
Add test for issue-48027
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Oct 14, 2019
1 parent f653db9 commit 88a495c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/test/ui/associated-item/issue-48027.rs
@@ -0,0 +1,8 @@
trait Bar {
const X: usize;
fn return_n(&self) -> [u8; Bar::X]; //~ ERROR: type annotations needed
}

impl dyn Bar {} //~ ERROR: the trait `Bar` cannot be made into an object

fn main() {}
21 changes: 21 additions & 0 deletions src/test/ui/associated-item/issue-48027.stderr
@@ -0,0 +1,21 @@
error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/issue-48027.rs:6:6
|
LL | const X: usize;
| - the trait cannot contain associated consts like `X`
...
LL | impl dyn Bar {}
| ^^^^^^^ the trait `Bar` cannot be made into an object

error[E0283]: type annotations needed: cannot resolve `_: Bar`
--> $DIR/issue-48027.rs:3:32
|
LL | const X: usize;
| --------------- required by `Bar::X`
LL | fn return_n(&self) -> [u8; Bar::X];
| ^^^^^^

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0038, E0283.
For more information about an error, try `rustc --explain E0038`.

0 comments on commit 88a495c

Please sign in to comment.