]> git.lizzy.rs Git - rust.git/commitdiff
typeck: on wrong <expr>.await suggest -> 2018
authorMazdak Farrokhzad <twingoow@gmail.com>
Tue, 13 Aug 2019 23:51:41 +0000 (01:51 +0200)
committerMazdak Farrokhzad <twingoow@gmail.com>
Tue, 13 Aug 2019 23:51:41 +0000 (01:51 +0200)
src/librustc_typeck/check/expr.rs

index 57e82714150e8fc6f86a79de366e86a0364ef356..d139cd4264c86f707c9f5cfddcf53f7bd518a30e 100644 (file)
@@ -1360,6 +1360,14 @@ fn check_field(
                 _ => {}
             }
 
+            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!(