File tree 2 files changed +29
-0
lines changed
src/test/ui/specialization
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change
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 number Diff line number Diff line change
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`.
You can’t perform that action at this time.
0 commit comments