Skip to content

Commit

Permalink
typeck: on wrong <expr>.await suggest -> 2018
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Aug 13, 2019
1 parent 0741441 commit 88398a4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/librustc_typeck/check/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
_ => {}
}

if field.name == kw::Await {
// We know by construction that `<expr>.await` is either on Rust 2015
// or results in `ExprKind::Await`. Suggest switching the edition to 2018.
err.note("to `.await` a `Future`, switch to Rust 2018");
err.help("set `edition = \"2018\"` in `Cargo.toml`");
err.note("for more on editions, read https://doc.rust-lang.org/edition-guide");
}

err.emit();
} else {
type_error_struct!(
Expand Down

0 comments on commit 88398a4

Please sign in to comment.