-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #70725 - Centril:nix-unwraps, r=estebank
Avoid `.unwrap()`s on `.span_to_snippet(...)`s First commit fixes #70724 and the others fix similar issues found by grepping. r? @estebank
- Loading branch information
Showing
7 changed files
with
116 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
fn a() -> i32 { | ||
3 | ||
} | ||
|
||
pub fn main() { | ||
assert_eq!(a, 0); | ||
//~^ ERROR binary operation `==` cannot | ||
//~| ERROR mismatched types | ||
//~| ERROR doesn't implement | ||
} |
41 changes: 41 additions & 0 deletions
41
src/test/ui/issues/issue-70724-add_type_neq_err_label-unwrap.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
error[E0369]: binary operation `==` cannot be applied to type `fn() -> i32 {a}` | ||
--> $DIR/issue-70724-add_type_neq_err_label-unwrap.rs:6:5 | ||
| | ||
LL | assert_eq!(a, 0); | ||
| ^^^^^^^^^^^^^^^^^ | ||
| | | ||
| fn() -> i32 {a} | ||
| {integer} | ||
| help: you might have forgotten to call this function: `*left_val()` | ||
| | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-70724-add_type_neq_err_label-unwrap.rs:6:5 | ||
| | ||
LL | assert_eq!(a, 0); | ||
| ^^^^^^^^^^^^^^^^^ expected fn item, found integer | ||
| | ||
= note: expected fn item `fn() -> i32 {a}` | ||
found type `i32` | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0277]: `fn() -> i32 {a}` doesn't implement `std::fmt::Debug` | ||
--> $DIR/issue-70724-add_type_neq_err_label-unwrap.rs:6:5 | ||
| | ||
LL | fn a() -> i32 { | ||
| - consider calling this function | ||
... | ||
LL | assert_eq!(a, 0); | ||
| ^^^^^^^^^^^^^^^^^ `fn() -> i32 {a}` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` | ||
| | ||
= help: the trait `std::fmt::Debug` is not implemented for `fn() -> i32 {a}` | ||
= help: use parentheses to call the function: `a()` | ||
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&fn() -> i32 {a}` | ||
= note: required by `std::fmt::Debug::fmt` | ||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0277, E0308, E0369. | ||
For more information about an error, try `rustc --explain E0277`. |