-
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.
Auto merge of #79576 - m-ou-se:2021, r=Mark-Simulacrum
Add edition 2021. :fireworks: Happy new ~~year~~ Rust. :champagne: This adds --edition=2021, and updates suggestions about 2018 to say "2018 *or later*". Related Cargo PR: rust-lang/cargo#8922 --- Edit: This adds the new edition as *unstable*. Without `-Z unstable-options`, `--edition=2021` results in: ``` $ rustc --edition=2021 error: edition 2021 is unstable and only available with -Z unstable-options. ```
- Loading branch information
Showing
17 changed files
with
87 additions
and
59 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
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
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,38 +1,38 @@ | ||
// edition:2015 | ||
|
||
async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition | ||
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015 | ||
|
||
fn baz() { async fn foo() {} } //~ ERROR `async fn` is not permitted in the 2015 edition | ||
fn baz() { async fn foo() {} } //~ ERROR `async fn` is not permitted in Rust 2015 | ||
|
||
async fn async_baz() { //~ ERROR `async fn` is not permitted in the 2015 edition | ||
async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition | ||
async fn async_baz() { //~ ERROR `async fn` is not permitted in Rust 2015 | ||
async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015 | ||
} | ||
|
||
struct Foo {} | ||
|
||
impl Foo { | ||
async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition | ||
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015 | ||
} | ||
|
||
trait Bar { | ||
async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition | ||
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015 | ||
//~^ ERROR functions in traits cannot be declared `async` | ||
} | ||
|
||
fn main() { | ||
macro_rules! accept_item { ($x:item) => {} } | ||
|
||
accept_item! { | ||
async fn foo() {} //~ ERROR `async fn` is not permitted in the 2015 edition | ||
async fn foo() {} //~ ERROR `async fn` is not permitted in Rust 2015 | ||
} | ||
|
||
accept_item! { | ||
impl Foo { | ||
async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition | ||
async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015 | ||
} | ||
} | ||
|
||
let inside_closure = || { | ||
async fn bar() {} //~ ERROR `async fn` is not permitted in the 2015 edition | ||
async fn bar() {} //~ ERROR `async fn` is not permitted in Rust 2015 | ||
}; | ||
} |
36 changes: 18 additions & 18 deletions
36
src/test/ui/async-await/edition-deny-async-fns-2015.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
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.