Add test for issue-59435

This commit is contained in:
Yuki Okushi 2020-06-23 17:52:42 +09:00
parent 43ef554b6a
commit e817cd2a6e
No known key found for this signature in database
GPG key ID: B0986C85C0E2DAA1
2 changed files with 29 additions and 0 deletions

View file

@ -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();
}

View file

@ -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`.