@@ -6,34 +6,57 @@ LL | eq(foo::<u8>, bar::<u8>);
6
6
|
7
7
= note: expected fn item `fn(_) -> _ {foo::<u8>}`
8
8
found fn item `fn(_) -> _ {bar::<u8>}`
9
+ = note: different `fn` items always have unique types, even if their signatures are the same
10
+ = help: change the expectation to require function pointer `fn(isize) -> isize`
11
+ = help: if the expectation is due to type inference, cast the expected `fn` to a function pointer: `foo::<u8> as fn(isize) -> isize`
9
12
10
13
error[E0308]: mismatched types
11
- --> $DIR/fn-item-type.rs:19 :19
14
+ --> $DIR/fn-item-type.rs:22 :19
12
15
|
13
16
LL | eq(foo::<u8>, foo::<i8>);
14
17
| ^^^^^^^^^ expected `u8`, found `i8`
15
18
|
16
19
= note: expected fn item `fn(_) -> _ {foo::<u8>}`
17
20
found fn item `fn(_) -> _ {foo::<i8>}`
21
+ = note: different `fn` items always have unique types, even if their signatures are the same
22
+ = help: change the expectation to require function pointer `fn(isize) -> isize`
23
+ = help: if the expectation is due to type inference, cast the expected `fn` to a function pointer: `foo::<u8> as fn(isize) -> isize`
18
24
19
25
error[E0308]: mismatched types
20
- --> $DIR/fn-item-type.rs:23 :23
26
+ --> $DIR/fn-item-type.rs:29 :23
21
27
|
22
28
LL | eq(bar::<String>, bar::<Vec<u8>>);
23
29
| ^^^^^^^^^^^^^^ expected struct `std::string::String`, found struct `std::vec::Vec`
24
30
|
25
31
= note: expected fn item `fn(_) -> _ {bar::<std::string::String>}`
26
32
found fn item `fn(_) -> _ {bar::<std::vec::Vec<u8>>}`
33
+ = note: different `fn` items always have unique types, even if their signatures are the same
34
+ = help: change the expectation to require function pointer `fn(isize) -> isize`
35
+ = help: if the expectation is due to type inference, cast the expected `fn` to a function pointer: `bar::<std::string::String> as fn(isize) -> isize`
27
36
28
37
error[E0308]: mismatched types
29
- --> $DIR/fn-item-type.rs:30 :26
38
+ --> $DIR/fn-item-type.rs:39 :26
30
39
|
31
40
LL | eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
32
41
| ^^^^^^^^^^^^^^^^^ expected `u8`, found `u16`
33
42
|
34
43
= note: expected fn item `fn() {<u8 as Foo>::foo}`
35
44
found fn item `fn() {<u16 as Foo>::foo}`
45
+ = note: different `fn` items always have unique types, even if their signatures are the same
46
+ = help: change the expectation to require function pointer `fn()`
47
+ = help: if the expectation is due to type inference, cast the expected `fn` to a function pointer: `<u8 as Foo>::foo as fn()`
36
48
37
- error: aborting due to 4 previous errors
49
+ error[E0308]: mismatched types
50
+ --> $DIR/fn-item-type.rs:46:19
51
+ |
52
+ LL | eq(foo::<u8>, bar::<u8> as fn(isize) -> isize);
53
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn item, found fn pointer
54
+ |
55
+ = note: expected fn item `fn(_) -> _ {foo::<u8>}`
56
+ found fn pointer `fn(_) -> _`
57
+ = help: change the expectation to require function pointer `fn(isize) -> isize`
58
+ = help: if the expectation is due to type inference, cast the expected `fn` to a function pointer: `foo::<u8> as fn(isize) -> isize`
59
+
60
+ error: aborting due to 5 previous errors
38
61
39
62
For more information about this error, try `rustc --explain E0308`.
0 commit comments