-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
124 additions
and
129 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,49 @@ | ||
// A good chunk of these errors aren't shown to the user, but are still | ||
// required in the test for it to pass. | ||
|
||
fn a() { //~ NOTE this function should return `Result` or `Option` to accept `?` | ||
fn a() { | ||
let x = 5 > 2 ? true : false; | ||
//~^ ERROR Rust has no ternary operator | ||
//~| HELP use an `if-else` expression instead | ||
//~| ERROR the `?` operator can only be applied to values that implement `Try` [E0277] | ||
//~| HELP the trait `Try` is not implemented for `{integer}` | ||
//~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) [E0277] | ||
//~| HELP the trait `FromResidual<_>` is not implemented for `()` | ||
//~| NOTE in this expansion of desugaring of operator `?` | ||
//~| NOTE the `?` operator cannot be applied to type `{integer}` | ||
//~| NOTE in this expansion of desugaring of operator `?` | ||
//~| NOTE in this expansion of desugaring of operator `?` | ||
//~| NOTE cannot use the `?` operator in a function that returns `()` | ||
//~| NOTE in this expansion of desugaring of operator `?` | ||
} | ||
|
||
fn b() { //~ NOTE this function should return `Result` or `Option` to accept `?` | ||
fn b() { | ||
let x = 5 > 2 ? { true } : { false }; | ||
//~^ ERROR Rust has no ternary operator | ||
//~| HELP use an `if-else` expression instead | ||
//~| ERROR the `?` operator can only be applied to values that implement `Try` [E0277] | ||
//~| HELP the trait `Try` is not implemented for `{integer}` | ||
//~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) [E0277] | ||
//~| HELP the trait `FromResidual<_>` is not implemented for `()` | ||
//~| NOTE in this expansion of desugaring of operator `?` | ||
//~| NOTE the `?` operator cannot be applied to type `{integer}` | ||
//~| NOTE in this expansion of desugaring of operator `?` | ||
//~| NOTE in this expansion of desugaring of operator `?` | ||
//~| NOTE cannot use the `?` operator in a function that returns `()` | ||
//~| NOTE in this expansion of desugaring of operator `?` | ||
} | ||
|
||
fn c() { //~ NOTE this function should return `Result` or `Option` to accept `?` | ||
fn c() { | ||
let x = 5 > 2 ? f32::MAX : f32::MIN; | ||
//~^ ERROR Rust has no ternary operator | ||
//~| HELP use an `if-else` expression instead | ||
//~| ERROR the `?` operator can only be applied to values that implement `Try` [E0277] | ||
//~| HELP the trait `Try` is not implemented for `{integer}` | ||
//~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) [E0277] | ||
//~| HELP the trait `FromResidual<_>` is not implemented for `()` | ||
//~| NOTE in this expansion of desugaring of operator `?` | ||
//~| NOTE the `?` operator cannot be applied to type `{integer}` | ||
//~| NOTE in this expansion of desugaring of operator `?` | ||
//~| NOTE in this expansion of desugaring of operator `?` | ||
//~| NOTE cannot use the `?` operator in a function that returns `()` | ||
//~| NOTE in this expansion of desugaring of operator `?` | ||
} | ||
|
||
fn main() { //~ NOTE this function should return `Result` or `Option` to accept `?` | ||
fn main() { | ||
let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false }; | ||
//~^ ERROR Rust has no ternary operator | ||
//~| HELP use an `if-else` expression instead | ||
//~| ERROR expected one of `.`, `;`, `?`, `else`, or an operator, found `:` | ||
//~| NOTE expected one of `.`, `;`, `?`, `else`, or an operator | ||
//~| ERROR the `?` operator can only be applied to values that implement `Try` [E0277] | ||
//~| HELP the trait `Try` is not implemented for `{integer}` | ||
//~| ERROR the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`) [E0277] | ||
//~| HELP the trait `FromResidual<_>` is not implemented for `()` | ||
//~| NOTE type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728> | ||
//~| NOTE in this expansion of desugaring of operator `?` | ||
//~| NOTE the `?` operator cannot be applied to type `{integer}` | ||
//~| NOTE in this expansion of desugaring of operator `?` | ||
//~| NOTE in this expansion of desugaring of operator `?` | ||
//~| NOTE cannot use the `?` operator in a function that returns `()` | ||
//~| NOTE in this expansion of desugaring of operator `?` | ||
} |
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
Oops, something went wrong.