File tree 4 files changed +53
-0
lines changed
src/test/ui/type-alias-impl-trait
4 files changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Regression test for #74280.
2
+
3
+ #![ feature( type_alias_impl_trait) ]
4
+
5
+ type Test = impl Copy ;
6
+
7
+ fn test ( ) -> Test {
8
+ let y = || -> Test { ( ) } ;
9
+ //~^ ERROR: concrete type differs from previous defining opaque type use
10
+ 7
11
+ }
12
+
13
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error: concrete type differs from previous defining opaque type use
2
+ --> $DIR/issue-74280.rs:8:13
3
+ |
4
+ LL | let y = || -> Test { () };
5
+ | ^^^^^^^^^^^^^^^^^ expected `i32`, got `()`
6
+ |
7
+ note: previous use here
8
+ --> $DIR/issue-74280.rs:7:1
9
+ |
10
+ LL | fn test() -> Test {
11
+ | ^^^^^^^^^^^^^^^^^
12
+
13
+ error: aborting due to previous error
14
+
Original file line number Diff line number Diff line change
1
+ // Regression test for #77179.
2
+
3
+ #![ feature( type_alias_impl_trait) ]
4
+
5
+ type Pointer < T > = impl std:: ops:: Deref < Target =T > ;
6
+
7
+ fn test ( ) -> Pointer < _ > {
8
+ //~^ ERROR: the type placeholder `_` is not allowed within types
9
+ Box :: new ( 1 )
10
+ }
11
+
12
+ fn main ( ) {
13
+ test ( ) ;
14
+ }
Original file line number Diff line number Diff line change
1
+ error[E0121]: the type placeholder `_` is not allowed within types on item signatures for return types
2
+ --> $DIR/issue-77179.rs:7:22
3
+ |
4
+ LL | fn test() -> Pointer<_> {
5
+ | --------^-
6
+ | | |
7
+ | | not allowed in type signatures
8
+ | help: replace with the correct return type: `Box<i32>`
9
+
10
+ error: aborting due to previous error
11
+
12
+ For more information about this error, try `rustc --explain E0121`.
You can’t perform that action at this time.
0 commit comments