@@ -1240,15 +1240,14 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1240
1240
) ;
1241
1241
let res = res. base_res ( ) ;
1242
1242
if res != Res :: Err {
1243
- new_id = Some ( res. def_id ( ) ) ;
1244
- let span = trait_ref. path . span ;
1245
1243
if let PathResult :: Module ( ModuleOrUniformRoot :: Module ( module) ) = self . resolve_path (
1246
1244
& path,
1247
1245
Some ( TypeNS ) ,
1248
- false ,
1249
- span,
1246
+ true ,
1247
+ trait_ref . path . span ,
1250
1248
CrateLint :: SimplePath ( trait_ref. ref_id ) ,
1251
1249
) {
1250
+ new_id = Some ( res. def_id ( ) ) ;
1252
1251
new_val = Some ( ( module, trait_ref. clone ( ) ) ) ;
1253
1252
}
1254
1253
}
@@ -1413,7 +1412,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1413
1412
fn check_trait_item < F > (
1414
1413
& mut self ,
1415
1414
id : NodeId ,
1416
- ident : Ident ,
1415
+ mut ident : Ident ,
1417
1416
kind : & AssocItemKind ,
1418
1417
ns : Namespace ,
1419
1418
span : Span ,
@@ -1423,32 +1422,23 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
1423
1422
{
1424
1423
// If there is a TraitRef in scope for an impl, then the method must be in the trait.
1425
1424
let Some ( ( module, _) ) = & self . current_trait_ref else { return ; } ;
1426
- let mut binding = self . r . resolve_ident_in_module (
1427
- ModuleOrUniformRoot :: Module ( module) ,
1428
- ident,
1429
- ns,
1430
- & self . parent_scope ,
1431
- false ,
1432
- span,
1433
- ) ;
1434
- if binding. is_err ( ) {
1425
+ ident. span . normalize_to_macros_2_0_and_adjust ( module. expansion ) ;
1426
+ let key = self . r . new_key ( ident, ns) ;
1427
+ let mut binding = self . r . resolution ( module, key) . try_borrow ( ) . ok ( ) . and_then ( |r| r. binding ) ;
1428
+ debug ! ( ?binding) ;
1429
+ if binding. is_none ( ) {
1435
1430
// We could not find the trait item in the correct namespace.
1436
1431
// Check the other namespace to report an error.
1437
1432
let ns = match ns {
1438
1433
ValueNS => TypeNS ,
1439
1434
TypeNS => ValueNS ,
1440
1435
_ => ns,
1441
1436
} ;
1442
- binding = self . r . resolve_ident_in_module (
1443
- ModuleOrUniformRoot :: Module ( module) ,
1444
- ident,
1445
- ns,
1446
- & self . parent_scope ,
1447
- false ,
1448
- span,
1449
- ) ;
1437
+ let key = self . r . new_key ( ident, ns) ;
1438
+ binding = self . r . resolution ( module, key) . try_borrow ( ) . ok ( ) . and_then ( |r| r. binding ) ;
1439
+ debug ! ( ?binding) ;
1450
1440
}
1451
- let Ok ( binding) = binding else {
1441
+ let Some ( binding) = binding else {
1452
1442
// We could not find the method: report an error.
1453
1443
let candidate = self . find_similarly_named_assoc_item ( ident. name , kind) ;
1454
1444
let path = & self . current_trait_ref . as_ref ( ) . unwrap ( ) . 1 . path ;
0 commit comments