Skip to content

Commit

Permalink
Add test for issue-59435
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Jun 23, 2020
1 parent 43ef554 commit e817cd2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/test/ui/specialization/issue-59435.rs
@@ -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();
}
12 changes: 12 additions & 0 deletions src/test/ui/specialization/issue-59435.stderr
@@ -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`.

0 comments on commit e817cd2

Please sign in to comment.