Skip to content

Commit d71c06d

Browse files
committed
Remove two _ext methods.
`resolve_ident_in_module` is a very thin wrapper around `resolve_ident_in_module_ext`, and `resolve_ident_in_module_unadjusted` is a very thin wrapper around `resolve_ident_in_module_unadjusted_ext`. The wrappers make the call sites slightly more concise, but I don't think that's worth the extra code and indirection. This commit removes the two wrappers and removes the `_ext` suffixes from the inner methods.
1 parent e7dffee commit d71c06d

File tree

1 file changed

+13
-56
lines changed

1 file changed

+13
-56
lines changed

Diff for: compiler/rustc_resolve/src/ident.rs

+13-56
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
349349
ident,
350350
ns,
351351
parent_scope,
352+
false,
352353
finalize.map(|finalize| Finalize { used: Used::Scope, ..finalize }),
353354
ignore_binding,
354355
None,
@@ -493,7 +494,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
493494
Scope::CrateRoot => {
494495
let root_ident = Ident::new(kw::PathRoot, ident.span);
495496
let root_module = this.resolve_crate_root(root_ident);
496-
let binding = this.resolve_ident_in_module_ext(
497+
let binding = this.resolve_ident_in_module(
497498
ModuleOrUniformRoot::Module(root_module),
498499
ident,
499500
ns,
@@ -515,7 +516,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
515516
}
516517
Scope::Module(module, derive_fallback_lint_id) => {
517518
let adjusted_parent_scope = &ParentScope { module, ..*parent_scope };
518-
let binding = this.resolve_ident_in_module_unadjusted_ext(
519+
let binding = this.resolve_ident_in_module_unadjusted(
519520
ModuleOrUniformRoot::Module(module),
520521
ident,
521522
ns,
@@ -589,6 +590,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
589590
ident,
590591
ns,
591592
parent_scope,
593+
false,
592594
None,
593595
ignore_binding,
594596
ignore_import,
@@ -747,35 +749,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
747749
parent_scope: &ParentScope<'ra>,
748750
ignore_import: Option<Import<'ra>>,
749751
) -> Result<NameBinding<'ra>, Determinacy> {
750-
self.resolve_ident_in_module_ext(module, ident, ns, parent_scope, None, None, ignore_import)
752+
self.resolve_ident_in_module(module, ident, ns, parent_scope, None, None, ignore_import)
751753
.map_err(|(determinacy, _)| determinacy)
752754
}
753755

754756
#[instrument(level = "debug", skip(self))]
755757
pub(crate) fn resolve_ident_in_module(
756-
&mut self,
757-
module: ModuleOrUniformRoot<'ra>,
758-
ident: Ident,
759-
ns: Namespace,
760-
parent_scope: &ParentScope<'ra>,
761-
finalize: Option<Finalize>,
762-
ignore_binding: Option<NameBinding<'ra>>,
763-
ignore_import: Option<Import<'ra>>,
764-
) -> Result<NameBinding<'ra>, Determinacy> {
765-
self.resolve_ident_in_module_ext(
766-
module,
767-
ident,
768-
ns,
769-
parent_scope,
770-
finalize,
771-
ignore_binding,
772-
ignore_import,
773-
)
774-
.map_err(|(determinacy, _)| determinacy)
775-
}
776-
777-
#[instrument(level = "debug", skip(self))]
778-
fn resolve_ident_in_module_ext(
779758
&mut self,
780759
module: ModuleOrUniformRoot<'ra>,
781760
mut ident: Ident,
@@ -802,7 +781,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
802781
// No adjustments
803782
}
804783
}
805-
self.resolve_ident_in_module_unadjusted_ext(
784+
self.resolve_ident_in_module_unadjusted(
806785
module,
807786
ident,
808787
ns,
@@ -814,34 +793,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
814793
)
815794
}
816795

817-
#[instrument(level = "debug", skip(self))]
818-
fn resolve_ident_in_module_unadjusted(
819-
&mut self,
820-
module: ModuleOrUniformRoot<'ra>,
821-
ident: Ident,
822-
ns: Namespace,
823-
parent_scope: &ParentScope<'ra>,
824-
finalize: Option<Finalize>,
825-
ignore_binding: Option<NameBinding<'ra>>,
826-
ignore_import: Option<Import<'ra>>,
827-
) -> Result<NameBinding<'ra>, Determinacy> {
828-
self.resolve_ident_in_module_unadjusted_ext(
829-
module,
830-
ident,
831-
ns,
832-
parent_scope,
833-
false,
834-
finalize,
835-
ignore_binding,
836-
ignore_import,
837-
)
838-
.map_err(|(determinacy, _)| determinacy)
839-
}
840-
841796
/// Attempts to resolve `ident` in namespaces `ns` of `module`.
842797
/// Invariant: if `finalize` is `Some`, expansion and import resolution must be complete.
843798
#[instrument(level = "debug", skip(self))]
844-
fn resolve_ident_in_module_unadjusted_ext(
799+
fn resolve_ident_in_module_unadjusted(
845800
&mut self,
846801
module: ModuleOrUniformRoot<'ra>,
847802
ident: Ident,
@@ -1046,13 +1001,13 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
10461001
ignore_binding,
10471002
ignore_import,
10481003
) {
1049-
Err(Determined) => continue,
1004+
Err((Determined, _)) => continue,
10501005
Ok(binding)
10511006
if !self.is_accessible_from(binding.vis, single_import.parent_scope.module) =>
10521007
{
10531008
continue;
10541009
}
1055-
Ok(_) | Err(Undetermined) => return Err((Undetermined, Weak::No)),
1010+
Ok(_) | Err((Undetermined, _)) => return Err((Undetermined, Weak::No)),
10561011
}
10571012
}
10581013

@@ -1121,19 +1076,20 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
11211076
ident,
11221077
ns,
11231078
adjusted_parent_scope,
1079+
false,
11241080
None,
11251081
ignore_binding,
11261082
ignore_import,
11271083
);
11281084

11291085
match result {
1130-
Err(Determined) => continue,
1086+
Err((Determined, _)) => continue,
11311087
Ok(binding)
11321088
if !self.is_accessible_from(binding.vis, glob_import.parent_scope.module) =>
11331089
{
11341090
continue;
11351091
}
1136-
Ok(_) | Err(Undetermined) => return Err((Undetermined, Weak::Yes)),
1092+
Ok(_) | Err((Undetermined, _)) => return Err((Undetermined, Weak::Yes)),
11371093
}
11381094
}
11391095

@@ -1564,6 +1520,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
15641520
ignore_binding,
15651521
ignore_import,
15661522
)
1523+
.map_err(|(determinacy, _)| determinacy)
15671524
} else if let Some(ribs) = ribs
15681525
&& let Some(TypeNS | ValueNS) = opt_ns
15691526
{

0 commit comments

Comments
 (0)