@@ -6,7 +6,7 @@ use crate::Namespace::{self, MacroNS, TypeNS};
6
6
use crate :: { module_to_string, names_to_string} ;
7
7
use crate :: { AmbiguityError , AmbiguityErrorMisc , AmbiguityKind } ;
8
8
use 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 } ;
10
10
use crate :: { NameBinding , NameBindingKind , PathResult , PrivacyError , ToNameBinding } ;
11
11
12
12
use rustc_ast:: NodeId ;
@@ -175,29 +175,29 @@ impl<'a> Resolver<'a> {
175
175
ident : Ident ,
176
176
ns : Namespace ,
177
177
parent_scope : & ParentScope < ' a > ,
178
- record_used : Option < Span > ,
178
+ finalize : Option < Span > ,
179
179
) -> Result < & ' a NameBinding < ' a > , Determinacy > {
180
180
self . resolve_ident_in_module_unadjusted_ext (
181
181
module,
182
182
ident,
183
183
ns,
184
184
parent_scope,
185
185
false ,
186
- record_used ,
186
+ finalize ,
187
187
)
188
188
. map_err ( |( determinacy, _) | determinacy)
189
189
}
190
190
191
191
/// 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.
193
193
crate fn resolve_ident_in_module_unadjusted_ext (
194
194
& mut self ,
195
195
module : ModuleOrUniformRoot < ' a > ,
196
196
ident : Ident ,
197
197
ns : Namespace ,
198
198
parent_scope : & ParentScope < ' a > ,
199
199
restricted_shadowing : bool ,
200
- record_used : Option < Span > ,
200
+ finalize : Option < Span > ,
201
201
) -> Result < & ' a NameBinding < ' a > , ( Determinacy , Weak ) > {
202
202
let module = match module {
203
203
ModuleOrUniformRoot :: Module ( module) => module,
@@ -207,17 +207,16 @@ impl<'a> Resolver<'a> {
207
207
ident,
208
208
ScopeSet :: AbsolutePath ( ns) ,
209
209
parent_scope,
210
- record_used ,
211
- record_used . is_some ( ) ,
210
+ finalize ,
211
+ finalize . is_some ( ) ,
212
212
) ;
213
213
return binding. map_err ( |determinacy| ( determinacy, Weak :: No ) ) ;
214
214
}
215
215
ModuleOrUniformRoot :: ExternPrelude => {
216
216
assert ! ( !restricted_shadowing) ;
217
217
return if ns != TypeNS {
218
218
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 ( ) ) {
221
220
Ok ( binding)
222
221
} else if !self . graph_root . unexpanded_invocations . borrow ( ) . is_empty ( ) {
223
222
// Macro-expanded `extern crate` items can add names to extern prelude.
@@ -247,8 +246,8 @@ impl<'a> Resolver<'a> {
247
246
ident,
248
247
scopes,
249
248
parent_scope,
250
- record_used ,
251
- record_used . is_some ( ) ,
249
+ finalize ,
250
+ finalize . is_some ( ) ,
252
251
) ;
253
252
return binding. map_err ( |determinacy| ( determinacy, Weak :: No ) ) ;
254
253
}
@@ -258,7 +257,7 @@ impl<'a> Resolver<'a> {
258
257
let resolution =
259
258
self . resolution ( module, key) . try_borrow_mut ( ) . map_err ( |_| ( Determined , Weak :: No ) ) ?; // This happens when there is a cycle of imports.
260
259
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 {
262
261
if !restricted_shadowing && binding. expansion != LocalExpnId :: ROOT {
263
262
if let NameBindingKind :: Res ( _, true ) = binding. kind {
264
263
self . macro_expanded_macro_export_errors . insert ( ( path_span, binding. span ) ) ;
@@ -276,7 +275,7 @@ impl<'a> Resolver<'a> {
276
275
if usable { Ok ( binding) } else { Err ( ( Determined , Weak :: No ) ) }
277
276
} ;
278
277
279
- if let Some ( path_span) = record_used {
278
+ if let Some ( path_span) = finalize {
280
279
return resolution
281
280
. binding
282
281
. and_then ( |binding| {
@@ -773,7 +772,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
773
772
// not define any names while resolving its module path.
774
773
let orig_vis = import. vis . replace ( ty:: Visibility :: Invisible ) ;
775
774
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 ) ;
777
776
import. vis . set ( orig_vis) ;
778
777
779
778
match path_res {
@@ -865,13 +864,13 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
865
864
_ => None ,
866
865
} ;
867
866
let prev_ambiguity_errors_len = self . r . ambiguity_errors . len ( ) ;
868
- let crate_lint = CrateLint :: UsePath {
867
+ let finalize = Finalize :: UsePath {
869
868
root_id : import. root_id ,
870
869
root_span : import. root_span ,
871
870
path_span : import. span ,
872
871
} ;
873
872
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 ) ;
875
874
let no_ambiguity = self . r . ambiguity_errors . len ( ) == prev_ambiguity_errors_len;
876
875
if let Some ( orig_unusable_binding) = orig_unusable_binding {
877
876
self . r . unusable_binding = orig_unusable_binding;
@@ -958,7 +957,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
958
957
// 2 segments, so the `resolve_path` above won't trigger it.
959
958
let mut full_path = import. module_path . clone ( ) ;
960
959
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 ) ;
962
961
}
963
962
964
963
if let ModuleOrUniformRoot :: Module ( module) = module {
@@ -1223,7 +1222,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
1223
1222
full_path. push ( Segment :: from_ident ( ident) ) ;
1224
1223
self . r . per_ns ( |this, ns| {
1225
1224
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) ) ;
1227
1226
}
1228
1227
} ) ;
1229
1228
}
0 commit comments