@@ -6,34 +6,57 @@ LL | eq(foo::<u8>, bar::<u8>);
66 |
77 = note: expected fn item `fn(_) -> _ {foo::<u8>}`
88 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`
912
1013error[E0308]: mismatched types
11- --> $DIR/fn-item-type.rs:19 :19
14+ --> $DIR/fn-item-type.rs:22 :19
1215 |
1316LL | eq(foo::<u8>, foo::<i8>);
1417 | ^^^^^^^^^ expected `u8`, found `i8`
1518 |
1619 = note: expected fn item `fn(_) -> _ {foo::<u8>}`
1720 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`
1824
1925error[E0308]: mismatched types
20- --> $DIR/fn-item-type.rs:23 :23
26+ --> $DIR/fn-item-type.rs:29 :23
2127 |
2228LL | eq(bar::<String>, bar::<Vec<u8>>);
2329 | ^^^^^^^^^^^^^^ expected struct `std::string::String`, found struct `std::vec::Vec`
2430 |
2531 = note: expected fn item `fn(_) -> _ {bar::<std::string::String>}`
2632 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`
2736
2837error[E0308]: mismatched types
29- --> $DIR/fn-item-type.rs:30 :26
38+ --> $DIR/fn-item-type.rs:39 :26
3039 |
3140LL | eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
3241 | ^^^^^^^^^^^^^^^^^ expected `u8`, found `u16`
3342 |
3443 = note: expected fn item `fn() {<u8 as Foo>::foo}`
3544 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()`
3648
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
3861
3962For more information about this error, try `rustc --explain E0308`.
0 commit comments