Skip to content

Commit 24b37a7

Browse files
committed
Pass last_import_segment and unusable_binding as parameters.
1 parent eb7f567 commit 24b37a7

File tree

8 files changed

+177
-79
lines changed

8 files changed

+177
-79
lines changed

compiler/rustc_resolve/src/build_reduced_graph.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
297297
Some(TypeNS),
298298
parent_scope,
299299
if finalize { Finalize::SimplePath(id, path.span) } else { Finalize::No },
300+
None,
300301
) {
301302
PathResult::Module(ModuleOrUniformRoot::Module(module)) => {
302303
let res = module.res().expect("visibility resolved to unnamed block");
@@ -1124,12 +1125,11 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
11241125
});
11251126
} else {
11261127
for ident in single_imports.iter().cloned() {
1127-
let result = self.r.resolve_ident_in_module(
1128+
let result = self.r.maybe_resolve_ident_in_module(
11281129
ModuleOrUniformRoot::Module(module),
11291130
ident,
11301131
MacroNS,
11311132
&self.parent_scope,
1132-
None,
11331133
);
11341134
if let Ok(binding) = result {
11351135
let import = macro_use_import(self, ident.span);

compiler/rustc_resolve/src/diagnostics.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use crate::imports::{Import, ImportKind, ImportResolver};
2525
use crate::path_names_to_string;
2626
use crate::{AmbiguityError, AmbiguityErrorMisc, AmbiguityKind};
2727
use crate::{BindingError, HasGenericParams, MacroRulesScope, Module, ModuleOrUniformRoot};
28-
use crate::{Finalize, NameBinding, NameBindingKind, PrivacyError, VisResolutionError};
28+
use crate::{NameBinding, NameBindingKind, PrivacyError, VisResolutionError};
2929
use crate::{ParentScope, PathResult, ResolutionError, Resolver, Scope, ScopeSet, Segment};
3030

3131
type Res = def::Res<ast::NodeId>;
@@ -1076,6 +1076,8 @@ impl<'a> Resolver<'a> {
10761076
&parent_scope,
10771077
None,
10781078
false,
1079+
false,
1080+
None,
10791081
) {
10801082
let desc = match binding.res() {
10811083
Res::Def(DefKind::Macro(MacroKind::Bang), _) => {
@@ -1422,7 +1424,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
14221424
) -> Option<(Vec<Segment>, Vec<String>)> {
14231425
// Replace first ident with `self` and check if that is valid.
14241426
path[0].ident.name = kw::SelfLower;
1425-
let result = self.r.resolve_path(&path, None, parent_scope, Finalize::No);
1427+
let result = self.r.maybe_resolve_path(&path, None, parent_scope);
14261428
debug!("make_missing_self_suggestion: path={:?} result={:?}", path, result);
14271429
if let PathResult::Module(..) = result { Some((path, Vec::new())) } else { None }
14281430
}
@@ -1441,7 +1443,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
14411443
) -> Option<(Vec<Segment>, Vec<String>)> {
14421444
// Replace first ident with `crate` and check if that is valid.
14431445
path[0].ident.name = kw::Crate;
1444-
let result = self.r.resolve_path(&path, None, parent_scope, Finalize::No);
1446+
let result = self.r.maybe_resolve_path(&path, None, parent_scope);
14451447
debug!("make_missing_crate_suggestion: path={:?} result={:?}", path, result);
14461448
if let PathResult::Module(..) = result {
14471449
Some((
@@ -1472,7 +1474,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
14721474
) -> Option<(Vec<Segment>, Vec<String>)> {
14731475
// Replace first ident with `crate` and check if that is valid.
14741476
path[0].ident.name = kw::Super;
1475-
let result = self.r.resolve_path(&path, None, parent_scope, Finalize::No);
1477+
let result = self.r.maybe_resolve_path(&path, None, parent_scope);
14761478
debug!("make_missing_super_suggestion: path={:?} result={:?}", path, result);
14771479
if let PathResult::Module(..) = result { Some((path, Vec::new())) } else { None }
14781480
}
@@ -1506,7 +1508,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
15061508
for name in extern_crate_names.into_iter() {
15071509
// Replace first ident with a crate name and check if that is valid.
15081510
path[0].ident.name = name;
1509-
let result = self.r.resolve_path(&path, None, parent_scope, Finalize::No);
1511+
let result = self.r.maybe_resolve_path(&path, None, parent_scope);
15101512
debug!(
15111513
"make_external_crate_suggestion: name={:?} path={:?} result={:?}",
15121514
name, path, result

0 commit comments

Comments
 (0)