add the logic for when other_ty is FnDef
This commit is contained in:
parent
199b0bad3c
commit
d01ac0d61e
4 changed files with 90 additions and 20 deletions
|
|
@ -7,6 +7,14 @@ LL | let x = f == g;
|
|||
| fn() {main::f}
|
||||
|
|
||||
= note: an implementation of `std::cmp::PartialEq` might be missing for `fn() {main::f}`
|
||||
help: you might have forgotten to call this function
|
||||
|
|
||||
LL | let x = f() == g;
|
||||
| ^^^
|
||||
help: you might have forgotten to call this function
|
||||
|
|
||||
LL | let x = f == g();
|
||||
| ^^^
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/fn-compare-mismatch.rs:4:18
|
||||
|
|
|
|||
|
|
@ -16,4 +16,11 @@ fn main() {
|
|||
bar > 13;
|
||||
//~^ ERROR 16:9: 16:10: binary operation `>` cannot be applied to type `fn(i64) -> i64 {bar}` [E0369]
|
||||
//~| ERROR 16:11: 16:13: mismatched types [E0308]
|
||||
|
||||
foo > foo;
|
||||
//~^ ERROR 20:9: 20:10: binary operation `>` cannot be applied to type `fn() -> i32 {foo}` [E0369]
|
||||
|
||||
foo > bar;
|
||||
//~^ ERROR 23:9: 23:10: binary operation `>` cannot be applied to type `fn() -> i32 {foo}` [E0369]
|
||||
//~| ERROR 23:11: 23:14: mismatched types [E0308]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ LL | foo > 12;
|
|||
| --- ^ -- {integer}
|
||||
| |
|
||||
| fn() -> i32 {foo}
|
||||
| help: did you forget: `foo()`
|
||||
| help: you might have forgotten to call this function: `foo()`
|
||||
|
|
||||
= note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> i32 {foo}`
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ LL | bar > 13;
|
|||
| --- ^ -- {integer}
|
||||
| |
|
||||
| fn(i64) -> i64 {bar}
|
||||
| help: did you forget: `bar( /* arguments */ )`
|
||||
| help: you might have forgotten to call this function: `bar( /* arguments */ )`
|
||||
|
|
||||
= note: an implementation of `std::cmp::PartialOrd` might be missing for `fn(i64) -> i64 {bar}`
|
||||
|
||||
|
|
@ -38,7 +38,44 @@ LL | bar > 13;
|
|||
= note: expected type `fn(i64) -> i64 {bar}`
|
||||
found type `i64`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error[E0369]: binary operation `>` cannot be applied to type `fn() -> i32 {foo}`
|
||||
--> $DIR/issue-59488.rs:20:9
|
||||
|
|
||||
LL | foo > foo;
|
||||
| --- ^ --- fn() -> i32 {foo}
|
||||
| |
|
||||
| fn() -> i32 {foo}
|
||||
|
|
||||
= note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> i32 {foo}`
|
||||
help: you might have forgotten to call this function
|
||||
|
|
||||
LL | foo() > foo;
|
||||
| ^^^^^
|
||||
help: you might have forgotten to call this function
|
||||
|
|
||||
LL | foo > foo();
|
||||
| ^^^^^
|
||||
|
||||
error[E0369]: binary operation `>` cannot be applied to type `fn() -> i32 {foo}`
|
||||
--> $DIR/issue-59488.rs:23:9
|
||||
|
|
||||
LL | foo > bar;
|
||||
| --- ^ --- fn(i64) -> i64 {bar}
|
||||
| |
|
||||
| fn() -> i32 {foo}
|
||||
|
|
||||
= note: an implementation of `std::cmp::PartialOrd` might be missing for `fn() -> i32 {foo}`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-59488.rs:23:11
|
||||
|
|
||||
LL | foo > bar;
|
||||
| ^^^ expected fn item, found a different fn item
|
||||
|
|
||||
= note: expected type `fn() -> i32 {foo}`
|
||||
found type `fn(i64) -> i64 {bar}`
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
Some errors occurred: E0308, E0369.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue