Skip to content

Commit cef919e

Browse files
committed
Address review comments: Remove new PathResult variant
1 parent 5a2c301 commit cef919e

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

src/librustc_resolve/lib.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -1034,8 +1034,6 @@ enum PathResult<'a> {
10341034
NonModule(PathResolution),
10351035
Indeterminate,
10361036
Failed(Span, String, bool /* is the error from the last segment? */),
1037-
/// Encountered an error that is reported elsewhere
1038-
Ignore,
10391037
}
10401038

10411039
enum ModuleKind {
@@ -1768,7 +1766,6 @@ impl<'a> Resolver<'a> {
17681766
error_callback(self, span, ResolutionError::FailedToResolve(&msg));
17691767
Def::Err
17701768
}
1771-
PathResult::Ignore => Def::Err,
17721769
};
17731770

17741771
let segments: Vec<_> = segments.iter().map(|seg| {
@@ -3696,7 +3693,7 @@ impl<'a> Resolver<'a> {
36963693
resolve_error(self, span, ResolutionError::FailedToResolve(&msg));
36973694
err_path_resolution()
36983695
}
3699-
PathResult::Module(..) | PathResult::Failed(..) | PathResult::Ignore => return None,
3696+
PathResult::Module(..) | PathResult::Failed(..) => return None,
37003697
PathResult::Indeterminate => bug!("indetermined path result in resolve_qpath"),
37013698
};
37023699

@@ -3928,11 +3925,11 @@ impl<'a> Resolver<'a> {
39283925
});
39293926
if let Some(candidate) = candidates.get(0) {
39303927
format!("did you mean `{}`?", candidate.path)
3931-
} else if !ident.is_used_keyword() {
3928+
} else if !ident.is_reserved() {
39323929
format!("maybe a missing `extern crate {};`?", ident)
39333930
} else {
39343931
// the parser will already have complained about the keyword being used
3935-
return PathResult::Ignore;
3932+
return PathResult::NonModule(err_path_resolution());
39363933
}
39373934
} else if i == 0 {
39383935
format!("use of undeclared type or module `{}`", ident)

src/librustc_resolve/macros.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,7 @@ impl<'a> Resolver<'a> {
364364
Ok(path_res.base_def())
365365
}
366366
PathResult::Indeterminate if !force => return Err(Determinacy::Undetermined),
367-
PathResult::NonModule(..) | PathResult::Indeterminate |
368-
PathResult::Failed(..) | PathResult::Ignore => {
367+
PathResult::NonModule(..) | PathResult::Indeterminate | PathResult::Failed(..) => {
369368
Err(Determinacy::Determined)
370369
}
371370
PathResult::Module(..) => unreachable!(),
@@ -930,8 +929,7 @@ impl<'a> Resolver<'a> {
930929
let def = path_res.base_def();
931930
check_consistency(self, &path, path_span, kind, initial_def, def);
932931
}
933-
path_res @ PathResult::NonModule(..) | path_res @ PathResult::Failed(..) |
934-
path_res @ PathResult::Ignore => {
932+
path_res @ PathResult::NonModule(..) | path_res @ PathResult::Failed(..) => {
935933
let (span, msg) = if let PathResult::Failed(span, msg, ..) = path_res {
936934
(span, msg)
937935
} else {

src/librustc_resolve/resolve_imports.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -767,8 +767,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
767767
match path_res {
768768
PathResult::Module(module) => module,
769769
PathResult::Indeterminate => return false,
770-
PathResult::NonModule(..) | PathResult::Failed(..) |
771-
PathResult::Ignore => return true,
770+
PathResult::NonModule(..) | PathResult::Failed(..) => return true,
772771
}
773772
};
774773

@@ -862,9 +861,6 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
862861

863862
module
864863
}
865-
PathResult::Ignore => {
866-
return None;
867-
}
868864
PathResult::Failed(span, msg, false) => {
869865
if no_ambiguity {
870866
assert!(directive.imported_module.get().is_none());

0 commit comments

Comments
 (0)