mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Auto merge of #57208 - estebank:issue-57198, r=petrochenkov
Do not complain about missing crate named as a keyword Fix #57198.
This commit is contained in:
@@ -3925,8 +3925,11 @@ fn resolve_path(
|
||||
});
|
||||
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)
|
||||
|
||||
@@ -929,7 +929,7 @@ pub fn finalize_current_module_macro_resolutions(&mut self) {
|
||||
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 {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// run-pass
|
||||
|
||||
mod m {
|
||||
pub fn r#for() {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
m::r#for();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
mod m {
|
||||
pub fn r#for() {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
m::for();
|
||||
//~^ ERROR expected identifier, found keyword `for`
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
error: expected identifier, found keyword `for`
|
||||
--> $DIR/issue-57198.rs:6:8
|
||||
|
|
||||
LL | m::for();
|
||||
| ^^^ expected identifier, found keyword
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Reference in New Issue
Block a user