1
1
error[E0308]: mismatched types
2
- --> $DIR/fn-item-type.rs:13 :19
2
+ --> $DIR/fn-item-type.rs:22 :19
3
3
|
4
4
LL | eq(foo::<u8>, bar::<u8>);
5
5
| -- ^^^^^^^^^ expected fn item, found a different fn item
@@ -8,17 +8,15 @@ LL | eq(foo::<u8>, bar::<u8>);
8
8
|
9
9
= note: expected fn item `fn(_) -> _ {foo::<u8>}`
10
10
found fn item `fn(_) -> _ {bar::<u8>}`
11
- = note: different `fn` items always have unique types, even if their signatures are the same
12
- = help: change the expected type to be function pointer `fn(isize) -> isize`
13
- = help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `foo::<u8> as fn(isize) -> isize`
11
+ = note: different fn items have unique types, even if their signatures are the same
14
12
note: function defined here
15
- --> $DIR/fn-item-type.rs:7 :4
13
+ --> $DIR/fn-item-type.rs:11 :4
16
14
|
17
- LL | fn eq<T>(x: T, y: T) { }
15
+ LL | fn eq<T>(x: T, y: T) {}
18
16
| ^^ ----
19
17
20
18
error[E0308]: mismatched types
21
- --> $DIR/fn-item-type.rs:22 :19
19
+ --> $DIR/fn-item-type.rs:29 :19
22
20
|
23
21
LL | eq(foo::<u8>, foo::<i8>);
24
22
| -- ^^^^^^^^^ expected `u8`, found `i8`
@@ -27,17 +25,15 @@ LL | eq(foo::<u8>, foo::<i8>);
27
25
|
28
26
= note: expected fn item `fn(_) -> _ {foo::<u8>}`
29
27
found fn item `fn(_) -> _ {foo::<i8>}`
30
- = note: different `fn` items always have unique types, even if their signatures are the same
31
- = help: change the expected type to be function pointer `fn(isize) -> isize`
32
- = help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `foo::<u8> as fn(isize) -> isize`
28
+ = note: different fn items have unique types, even if their signatures are the same
33
29
note: function defined here
34
- --> $DIR/fn-item-type.rs:7 :4
30
+ --> $DIR/fn-item-type.rs:11 :4
35
31
|
36
- LL | fn eq<T>(x: T, y: T) { }
32
+ LL | fn eq<T>(x: T, y: T) {}
37
33
| ^^ ----
38
34
39
35
error[E0308]: mismatched types
40
- --> $DIR/fn-item-type.rs:29 :23
36
+ --> $DIR/fn-item-type.rs:34 :23
41
37
|
42
38
LL | eq(bar::<String>, bar::<Vec<u8>>);
43
39
| -- ^^^^^^^^^^^^^^ expected struct `String`, found struct `Vec`
@@ -46,17 +42,15 @@ LL | eq(bar::<String>, bar::<Vec<u8>>);
46
42
|
47
43
= note: expected fn item `fn(_) -> _ {bar::<String>}`
48
44
found fn item `fn(_) -> _ {bar::<Vec<u8>>}`
49
- = note: different `fn` items always have unique types, even if their signatures are the same
50
- = help: change the expected type to be function pointer `fn(isize) -> isize`
51
- = help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `bar::<String> as fn(isize) -> isize`
45
+ = note: different fn items have unique types, even if their signatures are the same
52
46
note: function defined here
53
- --> $DIR/fn-item-type.rs:7 :4
47
+ --> $DIR/fn-item-type.rs:11 :4
54
48
|
55
- LL | fn eq<T>(x: T, y: T) { }
49
+ LL | fn eq<T>(x: T, y: T) {}
56
50
| ^^ ----
57
51
58
52
error[E0308]: mismatched types
59
- --> $DIR/fn-item-type.rs:38 :26
53
+ --> $DIR/fn-item-type.rs:41 :26
60
54
|
61
55
LL | eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
62
56
| -- ^^^^^^^^^^^^^^^^^ expected `u8`, found `u16`
@@ -65,17 +59,15 @@ LL | eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
65
59
|
66
60
= note: expected fn item `fn() {<u8 as Foo>::foo}`
67
61
found fn item `fn() {<u16 as Foo>::foo}`
68
- = note: different `fn` items always have unique types, even if their signatures are the same
69
- = help: change the expected type to be function pointer `fn()`
70
- = help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `<u8 as Foo>::foo as fn()`
62
+ = note: different fn items have unique types, even if their signatures are the same
71
63
note: function defined here
72
- --> $DIR/fn-item-type.rs:7 :4
64
+ --> $DIR/fn-item-type.rs:11 :4
73
65
|
74
- LL | fn eq<T>(x: T, y: T) { }
66
+ LL | fn eq<T>(x: T, y: T) {}
75
67
| ^^ ----
76
68
77
69
error[E0308]: mismatched types
78
- --> $DIR/fn-item-type.rs:45 :19
70
+ --> $DIR/fn-item-type.rs:46 :19
79
71
|
80
72
LL | eq(foo::<u8>, bar::<u8> as fn(isize) -> isize);
81
73
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn item, found fn pointer
@@ -84,12 +76,11 @@ LL | eq(foo::<u8>, bar::<u8> as fn(isize) -> isize);
84
76
|
85
77
= note: expected fn item `fn(_) -> _ {foo::<u8>}`
86
78
found fn pointer `fn(_) -> _`
87
- = help: change the expected type to be function pointer `fn(isize) -> isize`
88
- = help: if the expected type is due to type inference, cast the expected `fn` to a function pointer: `foo::<u8> as fn(isize) -> isize`
79
+ = note: fn items are distinct from fn pointers
89
80
note: function defined here
90
- --> $DIR/fn-item-type.rs:7 :4
81
+ --> $DIR/fn-item-type.rs:11 :4
91
82
|
92
- LL | fn eq<T>(x: T, y: T) { }
83
+ LL | fn eq<T>(x: T, y: T) {}
93
84
| ^^ ----
94
85
95
86
error: aborting due to 5 previous errors
0 commit comments