Add test for issue-59435
This commit is contained in:
parent
43ef554b6a
commit
e817cd2a6e
2 changed files with 29 additions and 0 deletions
17
src/test/ui/specialization/issue-59435.rs
Normal file
17
src/test/ui/specialization/issue-59435.rs
Normal 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();
|
||||
}
|
||||
12
src/test/ui/specialization/issue-59435.stderr
Normal file
12
src/test/ui/specialization/issue-59435.stderr
Normal 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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue