Skip to content

Commit 88398a4

Browse files
committed
typeck: on wrong <expr>.await suggest -> 2018
1 parent 0741441 commit 88398a4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/librustc_typeck/check/expr.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13601360
_ => {}
13611361
}
13621362

1363+
if field.name == kw::Await {
1364+
// We know by construction that `<expr>.await` is either on Rust 2015
1365+
// or results in `ExprKind::Await`. Suggest switching the edition to 2018.
1366+
err.note("to `.await` a `Future`, switch to Rust 2018");
1367+
err.help("set `edition = \"2018\"` in `Cargo.toml`");
1368+
err.note("for more on editions, read https://doc.rust-lang.org/edition-guide");
1369+
}
1370+
13631371
err.emit();
13641372
} else {
13651373
type_error_struct!(

0 commit comments

Comments
 (0)