@@ -82,14 +82,11 @@ pub struct LoweringContext<'a> {
82
82
83
83
pub trait Resolver {
84
84
// 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 ) ;
86
86
87
87
// Obtain the resolution for a node id
88
88
fn get_resolution ( & mut self , id : NodeId ) -> Option < PathResolution > ;
89
89
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
-
93
90
// We must keep the set of definitions up to date as we add nodes that weren't in the AST.
94
91
// This should only return `None` during testing.
95
92
fn definitions ( & mut self ) -> & mut Definitions ;
@@ -372,12 +369,7 @@ impl<'a> LoweringContext<'a> {
372
369
// Otherwise, the base path is an implicit `Self` type path,
373
370
// e.g. `Vec` in `Vec::new` or `<I as Iterator>::Item` in
374
371
// `<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) ) )
381
373
} ;
382
374
383
375
// Anything after the base path are associated "extensions",
@@ -1979,10 +1971,8 @@ impl<'a> LoweringContext<'a> {
1979
1971
def : def,
1980
1972
segments : hir_vec ! [ hir:: PathSegment :: from_name( id) ] ,
1981
1973
} ) ) ) ;
1982
- let expr = self . expr ( span, expr_path, ThinVec :: new ( ) ) ;
1983
- self . resolver . record_resolution ( expr. id , def) ;
1984
1974
1985
- expr
1975
+ self . expr ( span , expr_path , ThinVec :: new ( ) )
1986
1976
}
1987
1977
1988
1978
fn expr_mut_addr_of ( & mut self , span : Span , e : P < hir:: Expr > ) -> hir:: Expr {
@@ -1995,10 +1985,7 @@ impl<'a> LoweringContext<'a> {
1995
1985
attrs : ThinVec < Attribute > )
1996
1986
-> hir:: Expr {
1997
1987
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)
2002
1989
}
2003
1990
2004
1991
fn expr_match ( & mut self ,
@@ -2025,11 +2012,8 @@ impl<'a> LoweringContext<'a> {
2025
2012
e : Option < P < hir:: Expr > > ,
2026
2013
attrs : ThinVec < Attribute > ) -> hir:: Expr {
2027
2014
let path = self . std_path ( span, components, false ) ;
2028
- let def = path. def ;
2029
2015
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)
2033
2017
}
2034
2018
2035
2019
fn expr ( & mut self , span : Span , node : hir:: Expr_ , attrs : ThinVec < Attribute > ) -> hir:: Expr {
@@ -2098,16 +2082,13 @@ impl<'a> LoweringContext<'a> {
2098
2082
subpats : hir:: HirVec < P < hir:: Pat > > )
2099
2083
-> P < hir:: Pat > {
2100
2084
let path = self . std_path ( span, components, true ) ;
2101
- let def = path. def ;
2102
2085
let qpath = hir:: QPath :: Resolved ( None , P ( path) ) ;
2103
2086
let pt = if subpats. is_empty ( ) {
2104
2087
hir:: PatKind :: Path ( qpath)
2105
2088
} else {
2106
2089
hir:: PatKind :: TupleStruct ( qpath, subpats, None )
2107
2090
} ;
2108
- let pat = self . pat ( span, pt) ;
2109
- self . resolver . record_resolution ( pat. id , def) ;
2110
- pat
2091
+ self . pat ( span, pt)
2111
2092
}
2112
2093
2113
2094
fn pat_ident ( & mut self , span : Span , name : Name ) -> P < hir:: Pat > {
@@ -2124,7 +2105,6 @@ impl<'a> LoweringContext<'a> {
2124
2105
let def_index = defs. create_def_with_parent ( parent_def, id, def_path_data) ;
2125
2106
DefId :: local ( def_index)
2126
2107
} ;
2127
- self . resolver . record_resolution ( id, Def :: Local ( def_id) ) ;
2128
2108
2129
2109
P ( hir:: Pat {
2130
2110
id : id,
@@ -2168,7 +2148,7 @@ impl<'a> LoweringContext<'a> {
2168
2148
segments : segments. into ( ) ,
2169
2149
} ;
2170
2150
2171
- self . resolver . resolve_generated_global_path ( & mut path, is_value) ;
2151
+ self . resolver . resolve_hir_path ( & mut path, is_value) ;
2172
2152
path
2173
2153
}
2174
2154
0 commit comments