about summary refs log tree commit diff
path: root/src/librustc_resolve
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-12-31 08:06:15 +0000
committerbors <bors@rust-lang.org>2018-12-31 08:06:15 +0000
commitaeed63bf383e46bbaf932f4b555697ddb8328d89 (patch)
tree5483489af6f56e40b7e6224dfd7f4b140988777b /src/librustc_resolve
parentf39bd9b9cb71de6650bcf0c5b08e42af6f5df491 (diff)
parentcef919e9715556413730c85093ad0251ea1c90a3 (diff)
Auto merge of #57208 - estebank:issue-57198, r=petrochenkov
Do not complain about missing crate named as a keyword

Fix #57198.
Diffstat (limited to 'src/librustc_resolve')
-rw-r--r--src/librustc_resolve/lib.rs5
-rw-r--r--src/librustc_resolve/macros.rs2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index 6c7d0efbc02..47f9ad5398b 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -3925,8 +3925,11 @@ impl<'a> Resolver<'a> {
                         });
                         if let Some(candidate) = candidates.get(0) {
                             format!("did you mean `{}`?", candidate.path)
-                        } else {
+                        } else if !ident.is_reserved() {
                             format!("maybe a missing `extern crate {};`?", ident)
+                        } else {
+                            // the parser will already have complained about the keyword being used
+                            return PathResult::NonModule(err_path_resolution());
                         }
                     } else if i == 0 {
                         format!("use of undeclared type or module `{}`", ident)
diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs
index 8454dbc3410..379ebe23994 100644
--- a/src/librustc_resolve/macros.rs
+++ b/src/librustc_resolve/macros.rs
@@ -929,7 +929,7 @@ impl<'a> Resolver<'a> {
                     let def = path_res.base_def();
                     check_consistency(self, &path, path_span, kind, initial_def, def);
                 }
-                path_res @ PathResult::NonModule(..) | path_res @  PathResult::Failed(..) => {
+                path_res @ PathResult::NonModule(..) | path_res @ PathResult::Failed(..) => {
                     let (span, msg) = if let PathResult::Failed(span, msg, ..) = path_res {
                         (span, msg)
                     } else {