File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
src/test/ui/type-alias-impl-trait Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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`.
You can’t perform that action at this time.
0 commit comments