mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-03 02:23:20 +00:00
Rollup merge of #94708 - notriddle:notriddle/cargo-toml-warning, r=lcnr
diagnostics: only talk about `Cargo.toml` if running under Cargo Fixes #94646
This commit is contained in:
commit
98d027cfdd
@ -7,6 +7,7 @@ use crate::SuggestionStyle;
|
|||||||
use crate::ToolMetadata;
|
use crate::ToolMetadata;
|
||||||
use rustc_lint_defs::Applicability;
|
use rustc_lint_defs::Applicability;
|
||||||
use rustc_serialize::json::Json;
|
use rustc_serialize::json::Json;
|
||||||
|
use rustc_span::edition::LATEST_STABLE_EDITION;
|
||||||
use rustc_span::{MultiSpan, Span, DUMMY_SP};
|
use rustc_span::{MultiSpan, Span, DUMMY_SP};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
@ -342,6 +343,18 @@ impl Diagnostic {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Help the user upgrade to the latest edition.
|
||||||
|
/// This is factored out to make sure it does the right thing with `Cargo.toml`.
|
||||||
|
pub fn help_use_latest_edition(&mut self) -> &mut Self {
|
||||||
|
if std::env::var_os("CARGO").is_some() {
|
||||||
|
self.help(&format!("set `edition = \"{}\"` in `Cargo.toml`", LATEST_STABLE_EDITION));
|
||||||
|
} else {
|
||||||
|
self.help(&format!("pass `--edition {}` to `rustc`", LATEST_STABLE_EDITION));
|
||||||
|
}
|
||||||
|
self.note("for more on editions, read https://doc.rust-lang.org/edition-guide");
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Disallow attaching suggestions this diagnostic.
|
/// Disallow attaching suggestions this diagnostic.
|
||||||
/// Any suggestions attached e.g. with the `span_suggestion_*` methods
|
/// Any suggestions attached e.g. with the `span_suggestion_*` methods
|
||||||
/// (before and after the call to `disable_suggestions`) will be ignored.
|
/// (before and after the call to `disable_suggestions`) will be ignored.
|
||||||
|
@ -409,6 +409,7 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> {
|
|||||||
sp: impl Into<MultiSpan>,
|
sp: impl Into<MultiSpan>,
|
||||||
msg: &str,
|
msg: &str,
|
||||||
) -> &mut Self);
|
) -> &mut Self);
|
||||||
|
forward!(pub fn help_use_latest_edition(&mut self,) -> &mut Self);
|
||||||
forward!(pub fn set_is_lint(&mut self,) -> &mut Self);
|
forward!(pub fn set_is_lint(&mut self,) -> &mut Self);
|
||||||
|
|
||||||
forward!(pub fn disable_suggestions(&mut self,) -> &mut Self);
|
forward!(pub fn disable_suggestions(&mut self,) -> &mut Self);
|
||||||
|
@ -20,7 +20,6 @@ use rustc_ast_pretty::pprust;
|
|||||||
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed, PResult};
|
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed, PResult};
|
||||||
use rustc_session::lint::builtin::BREAK_WITH_LABEL_AND_LOOP;
|
use rustc_session::lint::builtin::BREAK_WITH_LABEL_AND_LOOP;
|
||||||
use rustc_session::lint::BuiltinLintDiagnostics;
|
use rustc_session::lint::BuiltinLintDiagnostics;
|
||||||
use rustc_span::edition::LATEST_STABLE_EDITION;
|
|
||||||
use rustc_span::source_map::{self, Span, Spanned};
|
use rustc_span::source_map::{self, Span, Spanned};
|
||||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||||
use rustc_span::{BytePos, Pos};
|
use rustc_span::{BytePos, Pos};
|
||||||
@ -2712,8 +2711,7 @@ impl<'a> Parser<'a> {
|
|||||||
let mut async_block_err = |e: &mut Diagnostic, span: Span| {
|
let mut async_block_err = |e: &mut Diagnostic, span: Span| {
|
||||||
recover_async = true;
|
recover_async = true;
|
||||||
e.span_label(span, "`async` blocks are only allowed in Rust 2018 or later");
|
e.span_label(span, "`async` blocks are only allowed in Rust 2018 or later");
|
||||||
e.help(&format!("set `edition = \"{}\"` in `Cargo.toml`", LATEST_STABLE_EDITION));
|
e.help_use_latest_edition();
|
||||||
e.note("for more on editions, read https://doc.rust-lang.org/edition-guide");
|
|
||||||
};
|
};
|
||||||
|
|
||||||
while self.token != token::CloseDelim(close_delim) {
|
while self.token != token::CloseDelim(close_delim) {
|
||||||
|
@ -14,7 +14,7 @@ use rustc_ast::{FnHeader, ForeignItem, Path, PathSegment, Visibility, Visibility
|
|||||||
use rustc_ast::{MacArgs, MacCall, MacDelimiter};
|
use rustc_ast::{MacArgs, MacCall, MacDelimiter};
|
||||||
use rustc_ast_pretty::pprust;
|
use rustc_ast_pretty::pprust;
|
||||||
use rustc_errors::{struct_span_err, Applicability, PResult, StashKey};
|
use rustc_errors::{struct_span_err, Applicability, PResult, StashKey};
|
||||||
use rustc_span::edition::{Edition, LATEST_STABLE_EDITION};
|
use rustc_span::edition::Edition;
|
||||||
use rustc_span::lev_distance::lev_distance;
|
use rustc_span::lev_distance::lev_distance;
|
||||||
use rustc_span::source_map::{self, Span};
|
use rustc_span::source_map::{self, Span};
|
||||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||||
@ -2102,8 +2102,7 @@ impl<'a> Parser<'a> {
|
|||||||
let diag = self.diagnostic();
|
let diag = self.diagnostic();
|
||||||
struct_span_err!(diag, span, E0670, "`async fn` is not permitted in Rust 2015")
|
struct_span_err!(diag, span, E0670, "`async fn` is not permitted in Rust 2015")
|
||||||
.span_label(span, "to use `async fn`, switch to Rust 2018 or later")
|
.span_label(span, "to use `async fn`, switch to Rust 2018 or later")
|
||||||
.help(&format!("set `edition = \"{}\"` in `Cargo.toml`", LATEST_STABLE_EDITION))
|
.help_use_latest_edition()
|
||||||
.note("for more on editions, read https://doc.rust-lang.org/edition-guide")
|
|
||||||
.emit();
|
.emit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,6 @@ use rustc_middle::ty::error::TypeError::{FieldMisMatch, Sorts};
|
|||||||
use rustc_middle::ty::subst::SubstsRef;
|
use rustc_middle::ty::subst::SubstsRef;
|
||||||
use rustc_middle::ty::{self, AdtKind, Ty, TypeFoldable};
|
use rustc_middle::ty::{self, AdtKind, Ty, TypeFoldable};
|
||||||
use rustc_session::parse::feature_err;
|
use rustc_session::parse::feature_err;
|
||||||
use rustc_span::edition::LATEST_STABLE_EDITION;
|
|
||||||
use rustc_span::hygiene::DesugaringKind;
|
use rustc_span::hygiene::DesugaringKind;
|
||||||
use rustc_span::lev_distance::find_best_match_for_name;
|
use rustc_span::lev_distance::find_best_match_for_name;
|
||||||
use rustc_span::source_map::Span;
|
use rustc_span::source_map::Span;
|
||||||
@ -2010,8 +2009,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
// We know by construction that `<expr>.await` is either on Rust 2015
|
// We know by construction that `<expr>.await` is either on Rust 2015
|
||||||
// or results in `ExprKind::Await`. Suggest switching the edition to 2018.
|
// or results in `ExprKind::Await`. Suggest switching the edition to 2018.
|
||||||
err.note("to `.await` a `Future`, switch to Rust 2018 or later");
|
err.note("to `.await` a `Future`, switch to Rust 2018 or later");
|
||||||
err.help(&format!("set `edition = \"{}\"` in `Cargo.toml`", LATEST_STABLE_EDITION));
|
err.help_use_latest_edition();
|
||||||
err.note("for more on editions, read https://doc.rust-lang.org/edition-guide");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err.emit();
|
err.emit();
|
||||||
|
@ -4,7 +4,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
|
|||||||
LL | async fn foo() {}
|
LL | async fn foo() {}
|
||||||
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
||||||
|
|
|
|
||||||
= help: set `edition = "2021"` in `Cargo.toml`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0670]: `async fn` is not permitted in Rust 2015
|
error[E0670]: `async fn` is not permitted in Rust 2015
|
||||||
@ -13,7 +13,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
|
|||||||
LL | fn baz() { async fn foo() {} }
|
LL | fn baz() { async fn foo() {} }
|
||||||
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
||||||
|
|
|
|
||||||
= help: set `edition = "2021"` in `Cargo.toml`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0670]: `async fn` is not permitted in Rust 2015
|
error[E0670]: `async fn` is not permitted in Rust 2015
|
||||||
@ -22,7 +22,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
|
|||||||
LL | async fn async_baz() {
|
LL | async fn async_baz() {
|
||||||
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
||||||
|
|
|
|
||||||
= help: set `edition = "2021"` in `Cargo.toml`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0670]: `async fn` is not permitted in Rust 2015
|
error[E0670]: `async fn` is not permitted in Rust 2015
|
||||||
@ -31,7 +31,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
|
|||||||
LL | async fn bar() {}
|
LL | async fn bar() {}
|
||||||
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
||||||
|
|
|
|
||||||
= help: set `edition = "2021"` in `Cargo.toml`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0670]: `async fn` is not permitted in Rust 2015
|
error[E0670]: `async fn` is not permitted in Rust 2015
|
||||||
@ -40,7 +40,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
|
|||||||
LL | async fn foo() {}
|
LL | async fn foo() {}
|
||||||
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
||||||
|
|
|
|
||||||
= help: set `edition = "2021"` in `Cargo.toml`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0670]: `async fn` is not permitted in Rust 2015
|
error[E0670]: `async fn` is not permitted in Rust 2015
|
||||||
@ -49,7 +49,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
|
|||||||
LL | async fn foo() {}
|
LL | async fn foo() {}
|
||||||
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
||||||
|
|
|
|
||||||
= help: set `edition = "2021"` in `Cargo.toml`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0670]: `async fn` is not permitted in Rust 2015
|
error[E0670]: `async fn` is not permitted in Rust 2015
|
||||||
@ -58,7 +58,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
|
|||||||
LL | async fn bar() {}
|
LL | async fn bar() {}
|
||||||
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
||||||
|
|
|
|
||||||
= help: set `edition = "2021"` in `Cargo.toml`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0670]: `async fn` is not permitted in Rust 2015
|
error[E0670]: `async fn` is not permitted in Rust 2015
|
||||||
@ -67,7 +67,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
|
|||||||
LL | async fn foo() {}
|
LL | async fn foo() {}
|
||||||
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
||||||
|
|
|
|
||||||
= help: set `edition = "2021"` in `Cargo.toml`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0670]: `async fn` is not permitted in Rust 2015
|
error[E0670]: `async fn` is not permitted in Rust 2015
|
||||||
@ -76,7 +76,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
|
|||||||
LL | async fn bar() {}
|
LL | async fn bar() {}
|
||||||
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
||||||
|
|
|
|
||||||
= help: set `edition = "2021"` in `Cargo.toml`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0706]: functions in traits cannot be declared `async`
|
error[E0706]: functions in traits cannot be declared `async`
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
// rustc-env:CARGO=/usr/bin/cargo
|
||||||
|
|
||||||
|
use std::pin::Pin;
|
||||||
|
use std::future::Future;
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
|
|
||||||
|
fn await_on_struct_missing() {
|
||||||
|
struct S;
|
||||||
|
let x = S;
|
||||||
|
x.await;
|
||||||
|
//~^ ERROR no field `await` on type
|
||||||
|
//~| NOTE unknown field
|
||||||
|
//~| NOTE to `.await` a `Future`, switch to Rust 2018
|
||||||
|
//~| HELP set `edition = "2021"` in `Cargo.toml`
|
||||||
|
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
}
|
||||||
|
|
||||||
|
fn await_on_struct_similar() {
|
||||||
|
struct S {
|
||||||
|
awai: u8,
|
||||||
|
}
|
||||||
|
let x = S { awai: 42 };
|
||||||
|
x.await;
|
||||||
|
//~^ ERROR no field `await` on type
|
||||||
|
//~| HELP a field with a similar name exists
|
||||||
|
//~| NOTE to `.await` a `Future`, switch to Rust 2018
|
||||||
|
//~| HELP set `edition = "2021"` in `Cargo.toml`
|
||||||
|
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
}
|
||||||
|
|
||||||
|
fn await_on_63533(x: Pin<&mut dyn Future<Output = ()>>) {
|
||||||
|
x.await;
|
||||||
|
//~^ ERROR no field `await` on type
|
||||||
|
//~| NOTE unknown field
|
||||||
|
//~| NOTE to `.await` a `Future`, switch to Rust 2018
|
||||||
|
//~| HELP set `edition = "2021"` in `Cargo.toml`
|
||||||
|
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
}
|
||||||
|
|
||||||
|
fn await_on_apit(x: impl Future<Output = ()>) {
|
||||||
|
x.await;
|
||||||
|
//~^ ERROR no field `await` on type
|
||||||
|
//~| NOTE to `.await` a `Future`, switch to Rust 2018
|
||||||
|
//~| HELP set `edition = "2021"` in `Cargo.toml`
|
||||||
|
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
error[E0609]: no field `await` on type `await_on_struct_missing::S`
|
||||||
|
--> $DIR/suggest-switching-edition-on-await-cargo.rs:11:7
|
||||||
|
|
|
||||||
|
LL | x.await;
|
||||||
|
| ^^^^^ unknown field
|
||||||
|
|
|
||||||
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
|
||||||
|
= help: set `edition = "2021"` in `Cargo.toml`
|
||||||
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
|
error[E0609]: no field `await` on type `await_on_struct_similar::S`
|
||||||
|
--> $DIR/suggest-switching-edition-on-await-cargo.rs:24:7
|
||||||
|
|
|
||||||
|
LL | x.await;
|
||||||
|
| ^^^^^ help: a field with a similar name exists: `awai`
|
||||||
|
|
|
||||||
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
|
||||||
|
= help: set `edition = "2021"` in `Cargo.toml`
|
||||||
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
|
error[E0609]: no field `await` on type `Pin<&mut dyn Future<Output = ()>>`
|
||||||
|
--> $DIR/suggest-switching-edition-on-await-cargo.rs:33:7
|
||||||
|
|
|
||||||
|
LL | x.await;
|
||||||
|
| ^^^^^ unknown field
|
||||||
|
|
|
||||||
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
|
||||||
|
= help: set `edition = "2021"` in `Cargo.toml`
|
||||||
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
|
error[E0609]: no field `await` on type `impl Future<Output = ()>`
|
||||||
|
--> $DIR/suggest-switching-edition-on-await-cargo.rs:42:7
|
||||||
|
|
|
||||||
|
LL | x.await;
|
||||||
|
| ^^^^^
|
||||||
|
|
|
||||||
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
|
||||||
|
= help: set `edition = "2021"` in `Cargo.toml`
|
||||||
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0609`.
|
@ -10,7 +10,7 @@ fn await_on_struct_missing() {
|
|||||||
//~^ ERROR no field `await` on type
|
//~^ ERROR no field `await` on type
|
||||||
//~| NOTE unknown field
|
//~| NOTE unknown field
|
||||||
//~| NOTE to `.await` a `Future`, switch to Rust 2018
|
//~| NOTE to `.await` a `Future`, switch to Rust 2018
|
||||||
//~| HELP set `edition = "2021"` in `Cargo.toml`
|
//~| HELP pass `--edition 2021` to `rustc`
|
||||||
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ fn await_on_struct_similar() {
|
|||||||
//~^ ERROR no field `await` on type
|
//~^ ERROR no field `await` on type
|
||||||
//~| HELP a field with a similar name exists
|
//~| HELP a field with a similar name exists
|
||||||
//~| NOTE to `.await` a `Future`, switch to Rust 2018
|
//~| NOTE to `.await` a `Future`, switch to Rust 2018
|
||||||
//~| HELP set `edition = "2021"` in `Cargo.toml`
|
//~| HELP pass `--edition 2021` to `rustc`
|
||||||
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ fn await_on_63533(x: Pin<&mut dyn Future<Output = ()>>) {
|
|||||||
//~^ ERROR no field `await` on type
|
//~^ ERROR no field `await` on type
|
||||||
//~| NOTE unknown field
|
//~| NOTE unknown field
|
||||||
//~| NOTE to `.await` a `Future`, switch to Rust 2018
|
//~| NOTE to `.await` a `Future`, switch to Rust 2018
|
||||||
//~| HELP set `edition = "2021"` in `Cargo.toml`
|
//~| HELP pass `--edition 2021` to `rustc`
|
||||||
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,6 +40,6 @@ fn await_on_apit(x: impl Future<Output = ()>) {
|
|||||||
x.await;
|
x.await;
|
||||||
//~^ ERROR no field `await` on type
|
//~^ ERROR no field `await` on type
|
||||||
//~| NOTE to `.await` a `Future`, switch to Rust 2018
|
//~| NOTE to `.await` a `Future`, switch to Rust 2018
|
||||||
//~| HELP set `edition = "2021"` in `Cargo.toml`
|
//~| HELP pass `--edition 2021` to `rustc`
|
||||||
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ LL | x.await;
|
|||||||
| ^^^^^ unknown field
|
| ^^^^^ unknown field
|
||||||
|
|
|
|
||||||
= note: to `.await` a `Future`, switch to Rust 2018 or later
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
|
||||||
= help: set `edition = "2021"` in `Cargo.toml`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0609]: no field `await` on type `await_on_struct_similar::S`
|
error[E0609]: no field `await` on type `await_on_struct_similar::S`
|
||||||
@ -15,7 +15,7 @@ LL | x.await;
|
|||||||
| ^^^^^ help: a field with a similar name exists: `awai`
|
| ^^^^^ help: a field with a similar name exists: `awai`
|
||||||
|
|
|
|
||||||
= note: to `.await` a `Future`, switch to Rust 2018 or later
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
|
||||||
= help: set `edition = "2021"` in `Cargo.toml`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0609]: no field `await` on type `Pin<&mut dyn Future<Output = ()>>`
|
error[E0609]: no field `await` on type `Pin<&mut dyn Future<Output = ()>>`
|
||||||
@ -25,7 +25,7 @@ LL | x.await;
|
|||||||
| ^^^^^ unknown field
|
| ^^^^^ unknown field
|
||||||
|
|
|
|
||||||
= note: to `.await` a `Future`, switch to Rust 2018 or later
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
|
||||||
= help: set `edition = "2021"` in `Cargo.toml`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0609]: no field `await` on type `impl Future<Output = ()>`
|
error[E0609]: no field `await` on type `impl Future<Output = ()>`
|
||||||
@ -35,7 +35,7 @@ LL | x.await;
|
|||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
|
||||||
= note: to `.await` a `Future`, switch to Rust 2018 or later
|
= note: to `.await` a `Future`, switch to Rust 2018 or later
|
||||||
= help: set `edition = "2021"` in `Cargo.toml`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
async fn foo() {
|
async fn foo() {
|
||||||
//~^ ERROR `async fn` is not permitted in Rust 2015
|
//~^ ERROR `async fn` is not permitted in Rust 2015
|
||||||
//~| NOTE to use `async fn`, switch to Rust 2018 or later
|
//~| NOTE to use `async fn`, switch to Rust 2018 or later
|
||||||
//~| HELP set `edition = "2021"` in `Cargo.toml`
|
//~| HELP pass `--edition 2021` to `rustc`
|
||||||
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
let x = async {};
|
let x = async {};
|
||||||
@ -11,7 +11,7 @@ async fn foo() {
|
|||||||
let x = 42;
|
let x = 42;
|
||||||
//~^ ERROR expected identifier, found keyword `let`
|
//~^ ERROR expected identifier, found keyword `let`
|
||||||
//~| NOTE expected identifier, found keyword
|
//~| NOTE expected identifier, found keyword
|
||||||
//~| HELP set `edition = "2021"` in `Cargo.toml`
|
//~| HELP pass `--edition 2021` to `rustc`
|
||||||
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
42
|
42
|
||||||
};
|
};
|
||||||
@ -19,7 +19,7 @@ async fn foo() {
|
|||||||
42
|
42
|
||||||
//~^ ERROR expected identifier, found `42`
|
//~^ ERROR expected identifier, found `42`
|
||||||
//~| NOTE expected identifier
|
//~| NOTE expected identifier
|
||||||
//~| HELP set `edition = "2021"` in `Cargo.toml`
|
//~| HELP pass `--edition 2021` to `rustc`
|
||||||
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
//~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
};
|
};
|
||||||
y.await;
|
y.await;
|
||||||
|
@ -4,7 +4,7 @@ error[E0670]: `async fn` is not permitted in Rust 2015
|
|||||||
LL | async fn foo() {
|
LL | async fn foo() {
|
||||||
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
| ^^^^^ to use `async fn`, switch to Rust 2018 or later
|
||||||
|
|
|
|
||||||
= help: set `edition = "2021"` in `Cargo.toml`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error: expected identifier, found keyword `let`
|
error: expected identifier, found keyword `let`
|
||||||
@ -15,7 +15,7 @@ LL | let y = async {
|
|||||||
LL | let x = 42;
|
LL | let x = 42;
|
||||||
| ^^^ expected identifier, found keyword
|
| ^^^ expected identifier, found keyword
|
||||||
|
|
|
|
||||||
= help: set `edition = "2021"` in `Cargo.toml`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error: expected identifier, found `42`
|
error: expected identifier, found `42`
|
||||||
@ -26,7 +26,7 @@ LL | let z = async {
|
|||||||
LL | 42
|
LL | 42
|
||||||
| ^^ expected identifier
|
| ^^ expected identifier
|
||||||
|
|
|
|
||||||
= help: set `edition = "2021"` in `Cargo.toml`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0422]: cannot find struct, variant or union type `async` in this scope
|
error[E0422]: cannot find struct, variant or union type `async` in this scope
|
||||||
|
@ -6,7 +6,7 @@ LL | let f: impl core::future::Future<Output = u8> = async { 1 };
|
|||||||
| |
|
| |
|
||||||
| `async` blocks are only allowed in Rust 2018 or later
|
| `async` blocks are only allowed in Rust 2018 or later
|
||||||
|
|
|
|
||||||
= help: set `edition = "2021"` in `Cargo.toml`
|
= help: pass `--edition 2021` to `rustc`
|
||||||
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
|
||||||
|
|
||||||
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding
|
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding
|
||||||
|
Loading…
Reference in New Issue
Block a user