@@ -1246,7 +1246,7 @@ impl<'a> Resolver<'a> {
1246
1246
-> ResolveResult < Module < ' a > > {
1247
1247
fn search_parent_externals < ' a > ( this : & mut Resolver < ' a > , needle : Name , module : Module < ' a > )
1248
1248
-> Option < Module < ' a > > {
1249
- match this. resolve_name_in_module ( module, needle, TypeNS , false , false ) {
1249
+ match this. resolve_name_in_module ( module, needle, TypeNS , false , None ) {
1250
1250
Success ( binding) if binding. is_extern_crate ( ) => Some ( module) ,
1251
1251
_ => match module. parent_link {
1252
1252
ModuleParentLink ( ref parent, _) => {
@@ -1265,7 +1265,7 @@ impl<'a> Resolver<'a> {
1265
1265
// modules as we go.
1266
1266
while index < module_path_len {
1267
1267
let name = module_path[ index] ;
1268
- match self . resolve_name_in_module ( search_module, name, TypeNS , false , true ) {
1268
+ match self . resolve_name_in_module ( search_module, name, TypeNS , false , Some ( span ) ) {
1269
1269
Failed ( None ) => {
1270
1270
let segment_name = name. as_str ( ) ;
1271
1271
let module_name = module_to_string ( search_module) ;
@@ -1361,7 +1361,7 @@ impl<'a> Resolver<'a> {
1361
1361
// first component of the path in the current lexical
1362
1362
// scope and then proceed to resolve below that.
1363
1363
let ident = ast:: Ident :: with_empty_ctxt ( module_path[ 0 ] ) ;
1364
- match self . resolve_ident_in_lexical_scope ( ident, TypeNS , true )
1364
+ match self . resolve_ident_in_lexical_scope ( ident, TypeNS , Some ( span ) )
1365
1365
. and_then ( LexicalScopeBinding :: module) {
1366
1366
None => return Failed ( None ) ,
1367
1367
Some ( containing_module) => {
@@ -1404,7 +1404,7 @@ impl<'a> Resolver<'a> {
1404
1404
fn resolve_ident_in_lexical_scope ( & mut self ,
1405
1405
mut ident : ast:: Ident ,
1406
1406
ns : Namespace ,
1407
- record_used : bool )
1407
+ record_used : Option < Span > )
1408
1408
-> Option < LexicalScopeBinding < ' a > > {
1409
1409
if ns == TypeNS {
1410
1410
ident = ast:: Ident :: with_empty_ctxt ( ident. name ) ;
@@ -1432,7 +1432,7 @@ impl<'a> Resolver<'a> {
1432
1432
if module. def . is_some ( ) {
1433
1433
return match self . prelude {
1434
1434
Some ( prelude) if !module. no_implicit_prelude . get ( ) => {
1435
- self . resolve_name_in_module ( prelude, name, ns, false , false ) . success ( )
1435
+ self . resolve_name_in_module ( prelude, name, ns, false , None ) . success ( )
1436
1436
. map ( LexicalScopeBinding :: Item )
1437
1437
}
1438
1438
_ => None ,
@@ -2287,7 +2287,7 @@ impl<'a> Resolver<'a> {
2287
2287
PatKind :: Ident ( bmode, ref ident, ref opt_pat) => {
2288
2288
// First try to resolve the identifier as some existing
2289
2289
// entity, then fall back to a fresh binding.
2290
- let binding = self . resolve_ident_in_lexical_scope ( ident. node , ValueNS , false )
2290
+ let binding = self . resolve_ident_in_lexical_scope ( ident. node , ValueNS , None )
2291
2291
. and_then ( LexicalScopeBinding :: item) ;
2292
2292
let resolution = binding. and_then ( NameBinding :: def) . and_then ( |def| {
2293
2293
let always_binding = !pat_src. is_refutable ( ) || opt_pat. is_some ( ) ||
@@ -2454,11 +2454,11 @@ impl<'a> Resolver<'a> {
2454
2454
//
2455
2455
// Such behavior is required for backward compatibility.
2456
2456
// The same fallback is used when `a` resolves to nothing.
2457
- let def = resolve_identifier_with_fallback ( self , true ) . ok_or ( false ) ;
2457
+ let def = resolve_identifier_with_fallback ( self , Some ( span ) ) . ok_or ( false ) ;
2458
2458
return def. and_then ( |def| self . adjust_local_def ( def, span) . ok_or ( true ) ) . map ( mk_res) ;
2459
2459
}
2460
2460
2461
- let unqualified_def = resolve_identifier_with_fallback ( self , false ) ;
2461
+ let unqualified_def = resolve_identifier_with_fallback ( self , None ) ;
2462
2462
let qualified_binding = self . resolve_module_relative_path ( span, segments, namespace) ;
2463
2463
match ( qualified_binding, unqualified_def) {
2464
2464
( Ok ( binding) , Some ( ref ud) ) if binding. def ( ) . unwrap ( ) == ud. def => {
@@ -2478,7 +2478,7 @@ impl<'a> Resolver<'a> {
2478
2478
fn resolve_identifier ( & mut self ,
2479
2479
identifier : ast:: Ident ,
2480
2480
namespace : Namespace ,
2481
- record_used : bool )
2481
+ record_used : Option < Span > )
2482
2482
-> Option < LocalDef > {
2483
2483
if identifier. name == keywords:: Invalid . name ( ) {
2484
2484
return None ;
@@ -2613,7 +2613,8 @@ impl<'a> Resolver<'a> {
2613
2613
}
2614
2614
2615
2615
let name = segments. last ( ) . unwrap ( ) . identifier . name ;
2616
- let result = self . resolve_name_in_module ( containing_module, name, namespace, false , true ) ;
2616
+ let result =
2617
+ self . resolve_name_in_module ( containing_module, name, namespace, false , Some ( span) ) ;
2617
2618
result. success ( ) . map ( |binding| {
2618
2619
self . check_privacy ( name, binding, span) ;
2619
2620
binding
@@ -2657,7 +2658,8 @@ impl<'a> Resolver<'a> {
2657
2658
}
2658
2659
2659
2660
let name = segments. last ( ) . unwrap ( ) . name ( ) ;
2660
- let result = self . resolve_name_in_module ( containing_module, name, namespace, false , true ) ;
2661
+ let result =
2662
+ self . resolve_name_in_module ( containing_module, name, namespace, false , Some ( span) ) ;
2661
2663
result. success ( ) . map ( |binding| {
2662
2664
self . check_privacy ( name, binding, span) ;
2663
2665
binding
0 commit comments