Add a regression test for issue-52843
This commit is contained in:
parent
9a74fb726e
commit
07627a3aa3
2 changed files with 29 additions and 0 deletions
15
src/test/ui/type-alias-impl-trait/issue-52843.rs
Normal file
15
src/test/ui/type-alias-impl-trait/issue-52843.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
type Foo<T> = impl Default;
|
||||
//~^ ERROR: the trait bound `T: Default` is not satisfied
|
||||
|
||||
#[allow(unused)]
|
||||
fn foo<T: Default>(t: T) -> Foo<T> {
|
||||
t
|
||||
}
|
||||
|
||||
struct NotDefault;
|
||||
|
||||
fn main() {
|
||||
let _ = Foo::<NotDefault>::default();
|
||||
}
|
||||
14
src/test/ui/type-alias-impl-trait/issue-52843.stderr
Normal file
14
src/test/ui/type-alias-impl-trait/issue-52843.stderr
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
error[E0277]: the trait bound `T: Default` is not satisfied
|
||||
--> $DIR/issue-52843.rs:3:15
|
||||
|
|
||||
LL | type Foo<T> = impl Default;
|
||||
| ^^^^^^^^^^^^ the trait `Default` is not implemented for `T`
|
||||
|
|
||||
help: consider restricting type parameter `T`
|
||||
|
|
||||
LL | type Foo<T: Default> = impl Default;
|
||||
| ^^^^^^^^^
|
||||
|
||||
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