@@ -1874,7 +1874,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1874
1874
trait_path : & Path ,
1875
1875
path_depth : usize )
1876
1876
-> Result < PathResolution , ( ) > {
1877
- if let Some ( path_res) = self . resolve_path ( id, trait_path, path_depth, TypeNS , true ) {
1877
+ if let Some ( path_res) = self . resolve_path ( id, trait_path, path_depth, TypeNS ) {
1878
1878
if let Def :: Trait ( _) = path_res. base_def {
1879
1879
debug ! ( "(resolving trait) found trait def: {:?}" , path_res) ;
1880
1880
Ok ( path_res)
@@ -1932,7 +1932,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1932
1932
& hir:: WherePredicate :: BoundPredicate ( _) |
1933
1933
& hir:: WherePredicate :: RegionPredicate ( _) => { }
1934
1934
& hir:: WherePredicate :: EqPredicate ( ref eq_pred) => {
1935
- let path_res = self . resolve_path ( eq_pred. id , & eq_pred. path , 0 , TypeNS , true ) ;
1935
+ let path_res = self . resolve_path ( eq_pred. id , & eq_pred. path , 0 , TypeNS ) ;
1936
1936
if let Some ( PathResolution { base_def : Def :: TyParam ( ..) , .. } ) = path_res {
1937
1937
self . record_def ( eq_pred. id , path_res. unwrap ( ) ) ;
1938
1938
} else {
@@ -2198,8 +2198,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2198
2198
let resolution = match self . resolve_possibly_assoc_item ( ty. id ,
2199
2199
maybe_qself. as_ref ( ) ,
2200
2200
path,
2201
- TypeNS ,
2202
- true ) {
2201
+ TypeNS ) {
2203
2202
// `<T>::a::b::c` is resolved by typeck alone.
2204
2203
TypecheckRequired => {
2205
2204
// Resolve embedded types.
@@ -2224,7 +2223,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2224
2223
self . record_def ( ty. id , err_path_resolution ( ) ) ;
2225
2224
2226
2225
// Keep reporting some errors even if they're ignored above.
2227
- self . resolve_path ( ty. id , path, 0 , TypeNS , true ) ;
2226
+ self . resolve_path ( ty. id , path, 0 , TypeNS ) ;
2228
2227
2229
2228
let kind = if maybe_qself. is_some ( ) {
2230
2229
"associated type"
@@ -2402,8 +2401,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2402
2401
let resolution = match self . resolve_possibly_assoc_item ( pat_id,
2403
2402
None ,
2404
2403
path,
2405
- ValueNS ,
2406
- false ) {
2404
+ ValueNS ) {
2407
2405
// The below shouldn't happen because all
2408
2406
// qualified paths should be in PatKind::QPath.
2409
2407
TypecheckRequired =>
@@ -2475,8 +2473,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2475
2473
let resolution = match self . resolve_possibly_assoc_item ( pat_id,
2476
2474
Some ( qself) ,
2477
2475
path,
2478
- ValueNS ,
2479
- false ) {
2476
+ ValueNS ) {
2480
2477
TypecheckRequired => {
2481
2478
// All `<T>::CONST` should end up here, and will
2482
2479
// require use of the trait map to resolve
@@ -2526,7 +2523,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2526
2523
}
2527
2524
2528
2525
PatKind :: Struct ( ref path, _, _) => {
2529
- match self . resolve_path ( pat_id, path, 0 , TypeNS , false ) {
2526
+ match self . resolve_path ( pat_id, path, 0 , TypeNS ) {
2530
2527
Some ( definition) => {
2531
2528
self . record_def ( pattern. id , definition) ;
2532
2529
}
@@ -2607,8 +2604,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2607
2604
id : NodeId ,
2608
2605
maybe_qself : Option < & hir:: QSelf > ,
2609
2606
path : & Path ,
2610
- namespace : Namespace ,
2611
- check_ribs : bool )
2607
+ namespace : Namespace )
2612
2608
-> AssocItemResolveResult {
2613
2609
let max_assoc_types;
2614
2610
@@ -2627,14 +2623,14 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2627
2623
}
2628
2624
2629
2625
let mut resolution = self . with_no_errors ( |this| {
2630
- this. resolve_path ( id, path, 0 , namespace, check_ribs )
2626
+ this. resolve_path ( id, path, 0 , namespace)
2631
2627
} ) ;
2632
2628
for depth in 1 ..max_assoc_types {
2633
2629
if resolution. is_some ( ) {
2634
2630
break ;
2635
2631
}
2636
2632
self . with_no_errors ( |this| {
2637
- resolution = this. resolve_path ( id, path, depth, TypeNS , true ) ;
2633
+ resolution = this. resolve_path ( id, path, depth, TypeNS ) ;
2638
2634
} ) ;
2639
2635
}
2640
2636
if let Some ( Def :: Mod ( _) ) = resolution. map ( |r| r. base_def ) {
@@ -2644,16 +2640,13 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2644
2640
ResolveAttempt ( resolution)
2645
2641
}
2646
2642
2647
- /// If `check_ribs` is true, checks the local definitions first; i.e.
2648
- /// doesn't skip straight to the containing module.
2649
2643
/// Skips `path_depth` trailing segments, which is also reflected in the
2650
2644
/// returned value. See `middle::def::PathResolution` for more info.
2651
2645
pub fn resolve_path ( & mut self ,
2652
2646
id : NodeId ,
2653
2647
path : & Path ,
2654
2648
path_depth : usize ,
2655
- namespace : Namespace ,
2656
- check_ribs : bool )
2649
+ namespace : Namespace )
2657
2650
-> Option < PathResolution > {
2658
2651
let span = path. span ;
2659
2652
let segments = & path. segments [ ..path. segments . len ( ) - path_depth] ;
@@ -2668,14 +2661,14 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2668
2661
// Try to find a path to an item in a module.
2669
2662
let last_ident = segments. last ( ) . unwrap ( ) . identifier ;
2670
2663
if segments. len ( ) <= 1 {
2671
- let unqualified_def = self . resolve_identifier ( last_ident, namespace, check_ribs , true ) ;
2664
+ let unqualified_def = self . resolve_identifier ( last_ident, namespace, true ) ;
2672
2665
return unqualified_def. and_then ( |def| self . adjust_local_def ( def, span) )
2673
2666
. map ( |def| {
2674
2667
PathResolution :: new ( def, path_depth)
2675
2668
} ) ;
2676
2669
}
2677
2670
2678
- let unqualified_def = self . resolve_identifier ( last_ident, namespace, check_ribs , false ) ;
2671
+ let unqualified_def = self . resolve_identifier ( last_ident, namespace, false ) ;
2679
2672
let def = self . resolve_module_relative_path ( span, segments, namespace) ;
2680
2673
match ( def, unqualified_def) {
2681
2674
( Some ( d) , Some ( ref ud) ) if d == ud. def => {
@@ -2695,7 +2688,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2695
2688
fn resolve_identifier ( & mut self ,
2696
2689
identifier : hir:: Ident ,
2697
2690
namespace : Namespace ,
2698
- check_ribs : bool ,
2699
2691
record_used : bool )
2700
2692
-> Option < LocalDef > {
2701
2693
if identifier. name == special_idents:: invalid. name {
@@ -2711,20 +2703,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
2711
2703
}
2712
2704
}
2713
2705
2714
- if check_ribs {
2715
- return self . resolve_identifier_in_local_ribs ( identifier, namespace, record_used) ;
2716
- }
2717
-
2718
- // Check the items.
2719
- let name = identifier. unhygienic_name ;
2720
- match self . resolve_item_in_lexical_scope ( name, namespace, record_used) {
2721
- Success ( binding) => binding. def ( ) . map ( LocalDef :: from_def) ,
2722
- Failed ( Some ( ( span, msg) ) ) => {
2723
- resolve_error ( self , span, ResolutionError :: FailedToResolve ( & msg) ) ;
2724
- None
2725
- }
2726
- _ => None ,
2727
- }
2706
+ self . resolve_identifier_in_local_ribs ( identifier, namespace, record_used)
2728
2707
}
2729
2708
2730
2709
// Resolve a local definition, potentially adjusting for closures.
@@ -3104,8 +3083,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
3104
3083
let resolution = match self . resolve_possibly_assoc_item ( expr. id ,
3105
3084
maybe_qself. as_ref ( ) ,
3106
3085
path,
3107
- ValueNS ,
3108
- true ) {
3086
+ ValueNS ) {
3109
3087
// `<T>::a::b::c` is resolved by typeck alone.
3110
3088
TypecheckRequired => {
3111
3089
let method_name = path. segments . last ( ) . unwrap ( ) . identifier . name ;
@@ -3165,7 +3143,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
3165
3143
// structs, which wouldn't result in this error.)
3166
3144
let path_name = path_names_to_string ( path, 0 ) ;
3167
3145
let type_res = self . with_no_errors ( |this| {
3168
- this. resolve_path ( expr. id , path, 0 , TypeNS , false )
3146
+ this. resolve_path ( expr. id , path, 0 , TypeNS )
3169
3147
} ) ;
3170
3148
3171
3149
self . record_def ( expr. id , err_path_resolution ( ) ) ;
@@ -3186,7 +3164,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
3186
3164
}
3187
3165
_ => {
3188
3166
// Keep reporting some errors even if they're ignored above.
3189
- self . resolve_path ( expr. id , path, 0 , ValueNS , true ) ;
3167
+ self . resolve_path ( expr. id , path, 0 , ValueNS ) ;
3190
3168
3191
3169
let mut method_scope = false ;
3192
3170
self . value_ribs . iter ( ) . rev ( ) . all ( |rib| {
@@ -3260,7 +3238,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
3260
3238
// Resolve the path to the structure it goes to. We don't
3261
3239
// check to ensure that the path is actually a structure; that
3262
3240
// is checked later during typeck.
3263
- match self . resolve_path ( expr. id , path, 0 , TypeNS , false ) {
3241
+ match self . resolve_path ( expr. id , path, 0 , TypeNS ) {
3264
3242
Some ( definition) => self . record_def ( expr. id , definition) ,
3265
3243
None => {
3266
3244
debug ! ( "(resolving expression) didn't find struct def" , ) ;
0 commit comments