Skip to content

Commit 07627a3

Browse files
committed
Add a regression test for issue-52843
1 parent 9a74fb7 commit 07627a3

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![feature(type_alias_impl_trait)]
2+
3+
type Foo<T> = impl Default;
4+
//~^ ERROR: the trait bound `T: Default` is not satisfied
5+
6+
#[allow(unused)]
7+
fn foo<T: Default>(t: T) -> Foo<T> {
8+
t
9+
}
10+
11+
struct NotDefault;
12+
13+
fn main() {
14+
let _ = Foo::<NotDefault>::default();
15+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0277]: the trait bound `T: Default` is not satisfied
2+
--> $DIR/issue-52843.rs:3:15
3+
|
4+
LL | type Foo<T> = impl Default;
5+
| ^^^^^^^^^^^^ the trait `Default` is not implemented for `T`
6+
|
7+
help: consider restricting type parameter `T`
8+
|
9+
LL | type Foo<T: Default> = impl Default;
10+
| ^^^^^^^^^
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)