diff options
| author | rchaser53 <tayoshizawa29@gmail.com> | 2019-04-12 22:59:30 +0900 |
|---|---|---|
| committer | rchaser53 <tayoshizawa29@gmail.com> | 2019-04-12 23:57:06 +0900 |
| commit | d01ac0d61e31ffdff0a85a76de6f4449935b5a6b (patch) | |
| tree | 9ae790562e9ba2c72bdefec39005a07cee8bac3a /src/test | |
| parent | 199b0bad3c233ba5bec8895efe6c8888c9ce5bee (diff) | |
| download | rust-d01ac0d61e31ffdff0a85a76de6f4449935b5a6b.tar.gz rust-d01ac0d61e31ffdff0a85a76de6f4449935b5a6b.zip | |
add the logic for when other_ty is FnDef
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/fn/fn-compare-mismatch.stderr | 8 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-59488.rs | 7 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-59488.stderr | 43 |
3 files changed, 55 insertions, 3 deletions
diff --git a/src/test/ui/fn/fn-compare-mismatch.stderr b/src/test/ui/fn/fn-compare-mismatch.stderr index 07b93d9aae7..74fb00f8ac3 100644 --- a/src/test/ui/fn/fn-compare-mismatch.stderr +++ b/src/test/ui/fn/fn-compare-mismatch.stderr @@ -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 diff --git a/src/test/ui/issues/issue-59488.rs b/src/test/ui/issues/issue-59488.rs index ab501a2c8ec..27cf16a821f 100644 --- a/src/test/ui/issues/issue-59488.rs +++ b/src/test/ui/issues/issue-59488.rs @@ -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] } diff --git a/src/test/ui/issues/issue-59488.stderr b/src/test/ui/issues/issue-59488.stderr index 2eaf4220a42..b49f5e35f42 100644 --- a/src/test/ui/issues/issue-59488.stderr +++ b/src/test/ui/issues/issue-59488.stderr @@ -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`. |
