Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#![feature(specialization)] | ||
#![allow(incomplete_features)] | ||
|
||
struct MyStruct {} | ||
|
||
trait MyTrait { | ||
type MyType: Default; | ||
} | ||
|
||
impl MyTrait for i32 { | ||
default type MyType = MyStruct; | ||
//~^ ERROR: the trait bound `MyStruct: std::default::Default` is not satisfied | ||
} | ||
|
||
fn main() { | ||
let _x: <i32 as MyTrait>::MyType = <i32 as MyTrait>::MyType::default(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0277]: the trait bound `MyStruct: std::default::Default` is not satisfied | ||
--> $DIR/issue-59435.rs:11:5 | ||
| | ||
LL | type MyType: Default; | ||
| --------------------- required by `MyTrait::MyType` | ||
... | ||
LL | default type MyType = MyStruct; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::default::Default` is not implemented for `MyStruct` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |