Skip to content

Commit 88a495c

Browse files
committed
Add test for issue-48027
1 parent f653db9 commit 88a495c

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
trait Bar {
2+
const X: usize;
3+
fn return_n(&self) -> [u8; Bar::X]; //~ ERROR: type annotations needed
4+
}
5+
6+
impl dyn Bar {} //~ ERROR: the trait `Bar` cannot be made into an object
7+
8+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0038]: the trait `Bar` cannot be made into an object
2+
--> $DIR/issue-48027.rs:6:6
3+
|
4+
LL | const X: usize;
5+
| - the trait cannot contain associated consts like `X`
6+
...
7+
LL | impl dyn Bar {}
8+
| ^^^^^^^ the trait `Bar` cannot be made into an object
9+
10+
error[E0283]: type annotations needed: cannot resolve `_: Bar`
11+
--> $DIR/issue-48027.rs:3:32
12+
|
13+
LL | const X: usize;
14+
| --------------- required by `Bar::X`
15+
LL | fn return_n(&self) -> [u8; Bar::X];
16+
| ^^^^^^
17+
18+
error: aborting due to 2 previous errors
19+
20+
Some errors have detailed explanations: E0038, E0283.
21+
For more information about an error, try `rustc --explain E0038`.

0 commit comments

Comments
 (0)