@@ -6,7 +6,7 @@ use crate::Namespace::{self, MacroNS, TypeNS};
66use crate :: { module_to_string, names_to_string} ;
77use crate :: { AmbiguityError , AmbiguityErrorMisc , AmbiguityKind } ;
88use crate :: { BindingKey , ModuleKind , ResolutionError , Resolver , Segment } ;
9- use crate :: { CrateLint , Module , ModuleOrUniformRoot , ParentScope , PerNS , ScopeSet , Weak } ;
9+ use crate :: { Finalize , Module , ModuleOrUniformRoot , ParentScope , PerNS , ScopeSet , Weak } ;
1010use crate :: { NameBinding , NameBindingKind , PathResult , PrivacyError , ToNameBinding } ;
1111
1212use rustc_ast:: NodeId ;
@@ -175,29 +175,29 @@ impl<'a> Resolver<'a> {
175175 ident : Ident ,
176176 ns : Namespace ,
177177 parent_scope : & ParentScope < ' a > ,
178- record_used : Option < Span > ,
178+ finalize : Option < Span > ,
179179 ) -> Result < & ' a NameBinding < ' a > , Determinacy > {
180180 self . resolve_ident_in_module_unadjusted_ext (
181181 module,
182182 ident,
183183 ns,
184184 parent_scope,
185185 false ,
186- record_used ,
186+ finalize ,
187187 )
188188 . map_err ( |( determinacy, _) | determinacy)
189189 }
190190
191191 /// Attempts to resolve `ident` in namespaces `ns` of `module`.
192- /// Invariant: if `record_used ` is `Some`, expansion and import resolution must be complete.
192+ /// Invariant: if `finalize ` is `Some`, expansion and import resolution must be complete.
193193 crate fn resolve_ident_in_module_unadjusted_ext (
194194 & mut self ,
195195 module : ModuleOrUniformRoot < ' a > ,
196196 ident : Ident ,
197197 ns : Namespace ,
198198 parent_scope : & ParentScope < ' a > ,
199199 restricted_shadowing : bool ,
200- record_used : Option < Span > ,
200+ finalize : Option < Span > ,
201201 ) -> Result < & ' a NameBinding < ' a > , ( Determinacy , Weak ) > {
202202 let module = match module {
203203 ModuleOrUniformRoot :: Module ( module) => module,
@@ -207,17 +207,16 @@ impl<'a> Resolver<'a> {
207207 ident,
208208 ScopeSet :: AbsolutePath ( ns) ,
209209 parent_scope,
210- record_used ,
211- record_used . is_some ( ) ,
210+ finalize ,
211+ finalize . is_some ( ) ,
212212 ) ;
213213 return binding. map_err ( |determinacy| ( determinacy, Weak :: No ) ) ;
214214 }
215215 ModuleOrUniformRoot :: ExternPrelude => {
216216 assert ! ( !restricted_shadowing) ;
217217 return if ns != TypeNS {
218218 Err ( ( Determined , Weak :: No ) )
219- } else if let Some ( binding) = self . extern_prelude_get ( ident, record_used. is_none ( ) )
220- {
219+ } else if let Some ( binding) = self . extern_prelude_get ( ident, finalize. is_some ( ) ) {
221220 Ok ( binding)
222221 } else if !self . graph_root . unexpanded_invocations . borrow ( ) . is_empty ( ) {
223222 // Macro-expanded `extern crate` items can add names to extern prelude.
@@ -247,8 +246,8 @@ impl<'a> Resolver<'a> {
247246 ident,
248247 scopes,
249248 parent_scope,
250- record_used ,
251- record_used . is_some ( ) ,
249+ finalize ,
250+ finalize . is_some ( ) ,
252251 ) ;
253252 return binding. map_err ( |determinacy| ( determinacy, Weak :: No ) ) ;
254253 }
@@ -258,7 +257,7 @@ impl<'a> Resolver<'a> {
258257 let resolution =
259258 self . resolution ( module, key) . try_borrow_mut ( ) . map_err ( |_| ( Determined , Weak :: No ) ) ?; // This happens when there is a cycle of imports.
260259
261- if let Some ( binding) = resolution. binding && let Some ( path_span) = record_used {
260+ if let Some ( binding) = resolution. binding && let Some ( path_span) = finalize {
262261 if !restricted_shadowing && binding. expansion != LocalExpnId :: ROOT {
263262 if let NameBindingKind :: Res ( _, true ) = binding. kind {
264263 self . macro_expanded_macro_export_errors . insert ( ( path_span, binding. span ) ) ;
@@ -276,7 +275,7 @@ impl<'a> Resolver<'a> {
276275 if usable { Ok ( binding) } else { Err ( ( Determined , Weak :: No ) ) }
277276 } ;
278277
279- if let Some ( path_span) = record_used {
278+ if let Some ( path_span) = finalize {
280279 return resolution
281280 . binding
282281 . and_then ( |binding| {
@@ -773,7 +772,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
773772 // not define any names while resolving its module path.
774773 let orig_vis = import. vis . replace ( ty:: Visibility :: Invisible ) ;
775774 let path_res =
776- self . r . resolve_path ( & import. module_path , None , & import. parent_scope , CrateLint :: No ) ;
775+ self . r . resolve_path ( & import. module_path , None , & import. parent_scope , Finalize :: No ) ;
777776 import. vis . set ( orig_vis) ;
778777
779778 match path_res {
@@ -865,13 +864,13 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
865864 _ => None ,
866865 } ;
867866 let prev_ambiguity_errors_len = self . r . ambiguity_errors . len ( ) ;
868- let crate_lint = CrateLint :: UsePath {
867+ let finalize = Finalize :: UsePath {
869868 root_id : import. root_id ,
870869 root_span : import. root_span ,
871870 path_span : import. span ,
872871 } ;
873872 let path_res =
874- self . r . resolve_path ( & import. module_path , None , & import. parent_scope , crate_lint ) ;
873+ self . r . resolve_path ( & import. module_path , None , & import. parent_scope , finalize ) ;
875874 let no_ambiguity = self . r . ambiguity_errors . len ( ) == prev_ambiguity_errors_len;
876875 if let Some ( orig_unusable_binding) = orig_unusable_binding {
877876 self . r . unusable_binding = orig_unusable_binding;
@@ -958,7 +957,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
958957 // 2 segments, so the `resolve_path` above won't trigger it.
959958 let mut full_path = import. module_path . clone ( ) ;
960959 full_path. push ( Segment :: from_ident ( Ident :: empty ( ) ) ) ;
961- self . r . lint_if_path_starts_with_module ( crate_lint , & full_path, None ) ;
960+ self . r . lint_if_path_starts_with_module ( finalize , & full_path, None ) ;
962961 }
963962
964963 if let ModuleOrUniformRoot :: Module ( module) = module {
@@ -1223,7 +1222,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
12231222 full_path. push ( Segment :: from_ident ( ident) ) ;
12241223 self . r . per_ns ( |this, ns| {
12251224 if let Ok ( binding) = source_bindings[ ns] . get ( ) {
1226- this. lint_if_path_starts_with_module ( crate_lint , & full_path, Some ( binding) ) ;
1225+ this. lint_if_path_starts_with_module ( finalize , & full_path, Some ( binding) ) ;
12271226 }
12281227 } ) ;
12291228 }
0 commit comments