File tree 2 files changed +47
-0
lines changed
src/test/ui/impl-trait/issues
2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ // edition:2021
2
+
3
+ use std:: iter;
4
+
5
+ fn f < T > ( data : & [ T ] ) -> impl Iterator < Item = Vec > {
6
+ //~^ ERROR: missing generics for struct `Vec` [E0107]
7
+ iter:: empty ( ) //~ ERROR: type annotations needed [E0282]
8
+ }
9
+
10
+ fn g < T > ( data : & [ T ] , target : T ) -> impl Iterator < Item = Vec < T > > {
11
+ //~^ ERROR: type annotations needed [E0282]
12
+ f ( data) . filter ( |x| x == target)
13
+ }
14
+
15
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0107]: missing generics for struct `Vec`
2
+ --> $DIR/issue-92305.rs:5:45
3
+ |
4
+ LL | fn f<T>(data: &[T]) -> impl Iterator<Item = Vec> {
5
+ | ^^^ expected at least 1 generic argument
6
+ |
7
+ note: struct defined here, with at least 1 generic parameter: `T`
8
+ --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
9
+ |
10
+ LL | pub struct Vec<T, #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global> {
11
+ | ^^^ -
12
+ help: add missing generic argument
13
+ |
14
+ LL | fn f<T>(data: &[T]) -> impl Iterator<Item = Vec<T>> {
15
+ | ~~~~~~
16
+
17
+ error[E0282]: type annotations needed
18
+ --> $DIR/issue-92305.rs:7:5
19
+ |
20
+ LL | iter::empty()
21
+ | ^^^^^^^^^^^ cannot infer type for type parameter `T` declared on the function `empty`
22
+
23
+ error[E0282]: type annotations needed
24
+ --> $DIR/issue-92305.rs:10:35
25
+ |
26
+ LL | fn g<T>(data: &[T], target: T) -> impl Iterator<Item = Vec<T>> {
27
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
28
+
29
+ error: aborting due to 3 previous errors
30
+
31
+ Some errors have detailed explanations: E0107, E0282.
32
+ For more information about an error, try `rustc --explain E0107`.
You can’t perform that action at this time.
0 commit comments