Skip to content

Commit e817cd2

Browse files
committed
Add test for issue-59435
1 parent 43ef554 commit e817cd2

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#![feature(specialization)]
2+
#![allow(incomplete_features)]
3+
4+
struct MyStruct {}
5+
6+
trait MyTrait {
7+
type MyType: Default;
8+
}
9+
10+
impl MyTrait for i32 {
11+
default type MyType = MyStruct;
12+
//~^ ERROR: the trait bound `MyStruct: std::default::Default` is not satisfied
13+
}
14+
15+
fn main() {
16+
let _x: <i32 as MyTrait>::MyType = <i32 as MyTrait>::MyType::default();
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0277]: the trait bound `MyStruct: std::default::Default` is not satisfied
2+
--> $DIR/issue-59435.rs:11:5
3+
|
4+
LL | type MyType: Default;
5+
| --------------------- required by `MyTrait::MyType`
6+
...
7+
LL | default type MyType = MyStruct;
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::default::Default` is not implemented for `MyStruct`
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)