@@ -82,14 +82,11 @@ pub struct LoweringContext<'a> {
8282
8383pub trait Resolver {
8484 // Resolve a global hir path generated by the lowerer when expanding `for`, `if let`, etc.
85- fn resolve_generated_global_path ( & mut self , path : & mut hir:: Path , is_value : bool ) ;
85+ fn resolve_hir_path ( & mut self , path : & mut hir:: Path , is_value : bool ) ;
8686
8787 // Obtain the resolution for a node id
8888 fn get_resolution ( & mut self , id : NodeId ) -> Option < PathResolution > ;
8989
90- // Record the resolution of a path or binding generated by the lowerer when expanding.
91- fn record_resolution ( & mut self , id : NodeId , def : Def ) ;
92-
9390 // We must keep the set of definitions up to date as we add nodes that weren't in the AST.
9491 // This should only return `None` during testing.
9592 fn definitions ( & mut self ) -> & mut Definitions ;
@@ -372,12 +369,7 @@ impl<'a> LoweringContext<'a> {
372369 // Otherwise, the base path is an implicit `Self` type path,
373370 // e.g. `Vec` in `Vec::new` or `<I as Iterator>::Item` in
374371 // `<I as Iterator>::Item::default`.
375- let ty = self . ty ( p. span , hir:: TyPath ( hir:: QPath :: Resolved ( qself, path) ) ) ;
376-
377- // Associate that innermost path type with the base Def.
378- self . resolver . record_resolution ( ty. id , resolution. base_def ) ;
379-
380- ty
372+ self . ty ( p. span , hir:: TyPath ( hir:: QPath :: Resolved ( qself, path) ) )
381373 } ;
382374
383375 // Anything after the base path are associated "extensions",
@@ -1979,10 +1971,8 @@ impl<'a> LoweringContext<'a> {
19791971 def : def,
19801972 segments : hir_vec ! [ hir:: PathSegment :: from_name( id) ] ,
19811973 } ) ) ) ;
1982- let expr = self . expr ( span, expr_path, ThinVec :: new ( ) ) ;
1983- self . resolver . record_resolution ( expr. id , def) ;
19841974
1985- expr
1975+ self . expr ( span , expr_path , ThinVec :: new ( ) )
19861976 }
19871977
19881978 fn expr_mut_addr_of ( & mut self , span : Span , e : P < hir:: Expr > ) -> hir:: Expr {
@@ -1995,10 +1985,7 @@ impl<'a> LoweringContext<'a> {
19951985 attrs : ThinVec < Attribute > )
19961986 -> hir:: Expr {
19971987 let path = self . std_path ( span, components, true ) ;
1998- let def = path. def ;
1999- let expr = self . expr ( span, hir:: ExprPath ( hir:: QPath :: Resolved ( None , P ( path) ) ) , attrs) ;
2000- self . resolver . record_resolution ( expr. id , def) ;
2001- expr
1988+ self . expr ( span, hir:: ExprPath ( hir:: QPath :: Resolved ( None , P ( path) ) ) , attrs)
20021989 }
20031990
20041991 fn expr_match ( & mut self ,
@@ -2025,11 +2012,8 @@ impl<'a> LoweringContext<'a> {
20252012 e : Option < P < hir:: Expr > > ,
20262013 attrs : ThinVec < Attribute > ) -> hir:: Expr {
20272014 let path = self . std_path ( span, components, false ) ;
2028- let def = path. def ;
20292015 let qpath = hir:: QPath :: Resolved ( None , P ( path) ) ;
2030- let expr = self . expr ( span, hir:: ExprStruct ( qpath, fields, e) , attrs) ;
2031- self . resolver . record_resolution ( expr. id , def) ;
2032- expr
2016+ self . expr ( span, hir:: ExprStruct ( qpath, fields, e) , attrs)
20332017 }
20342018
20352019 fn expr ( & mut self , span : Span , node : hir:: Expr_ , attrs : ThinVec < Attribute > ) -> hir:: Expr {
@@ -2098,16 +2082,13 @@ impl<'a> LoweringContext<'a> {
20982082 subpats : hir:: HirVec < P < hir:: Pat > > )
20992083 -> P < hir:: Pat > {
21002084 let path = self . std_path ( span, components, true ) ;
2101- let def = path. def ;
21022085 let qpath = hir:: QPath :: Resolved ( None , P ( path) ) ;
21032086 let pt = if subpats. is_empty ( ) {
21042087 hir:: PatKind :: Path ( qpath)
21052088 } else {
21062089 hir:: PatKind :: TupleStruct ( qpath, subpats, None )
21072090 } ;
2108- let pat = self . pat ( span, pt) ;
2109- self . resolver . record_resolution ( pat. id , def) ;
2110- pat
2091+ self . pat ( span, pt)
21112092 }
21122093
21132094 fn pat_ident ( & mut self , span : Span , name : Name ) -> P < hir:: Pat > {
@@ -2124,7 +2105,6 @@ impl<'a> LoweringContext<'a> {
21242105 let def_index = defs. create_def_with_parent ( parent_def, id, def_path_data) ;
21252106 DefId :: local ( def_index)
21262107 } ;
2127- self . resolver . record_resolution ( id, Def :: Local ( def_id) ) ;
21282108
21292109 P ( hir:: Pat {
21302110 id : id,
@@ -2168,7 +2148,7 @@ impl<'a> LoweringContext<'a> {
21682148 segments : segments. into ( ) ,
21692149 } ;
21702150
2171- self . resolver . resolve_generated_global_path ( & mut path, is_value) ;
2151+ self . resolver . resolve_hir_path ( & mut path, is_value) ;
21722152 path
21732153 }
21742154
0 commit comments