@@ -2120,52 +2120,8 @@ impl BorrowKind {
2120
2120
}
2121
2121
2122
2122
impl < ' a , ' gcx , ' tcx > TyCtxt < ' a , ' gcx , ' tcx > {
2123
- pub fn node_id_to_type ( self , id : NodeId ) -> Ty < ' gcx > {
2124
- match self . node_id_to_type_opt ( id) {
2125
- Some ( ty) => ty,
2126
- None => bug ! ( "node_id_to_type: no type for node `{}`" ,
2127
- self . map. node_to_string( id) )
2128
- }
2129
- }
2130
-
2131
- pub fn node_id_to_type_opt ( self , id : NodeId ) -> Option < Ty < ' gcx > > {
2132
- self . tables . borrow ( ) . node_types . get ( & id) . cloned ( )
2133
- }
2134
-
2135
- pub fn node_id_item_substs ( self , id : NodeId ) -> ItemSubsts < ' gcx > {
2136
- match self . tables . borrow ( ) . item_substs . get ( & id) {
2137
- None => ItemSubsts {
2138
- substs : self . global_tcx ( ) . intern_substs ( & [ ] )
2139
- } ,
2140
- Some ( ts) => ts. clone ( ) ,
2141
- }
2142
- }
2143
-
2144
- // Returns the type of a pattern as a monotype. Like @expr_ty, this function
2145
- // doesn't provide type parameter substitutions.
2146
- pub fn pat_ty ( self , pat : & hir:: Pat ) -> Ty < ' gcx > {
2147
- self . node_id_to_type ( pat. id )
2148
- }
2149
- pub fn pat_ty_opt ( self , pat : & hir:: Pat ) -> Option < Ty < ' gcx > > {
2150
- self . node_id_to_type_opt ( pat. id )
2151
- }
2152
-
2153
- // Returns the type of an expression as a monotype.
2154
- //
2155
- // NB (1): This is the PRE-ADJUSTMENT TYPE for the expression. That is, in
2156
- // some cases, we insert `AutoAdjustment` annotations such as auto-deref or
2157
- // auto-ref. The type returned by this function does not consider such
2158
- // adjustments. See `expr_ty_adjusted()` instead.
2159
- //
2160
- // NB (2): This type doesn't provide type parameter substitutions; e.g. if you
2161
- // ask for the type of "id" in "id(3)", it will return "fn(&isize) -> isize"
2162
- // instead of "fn(ty) -> T with T = isize".
2163
- pub fn expr_ty ( self , expr : & hir:: Expr ) -> Ty < ' gcx > {
2164
- self . node_id_to_type ( expr. id )
2165
- }
2166
-
2167
- pub fn expr_ty_opt ( self , expr : & hir:: Expr ) -> Option < Ty < ' gcx > > {
2168
- self . node_id_to_type_opt ( expr. id )
2123
+ pub fn tables ( self ) -> Ref < ' a , Tables < ' gcx > > {
2124
+ self . tables . borrow ( )
2169
2125
}
2170
2126
2171
2127
/// Returns the type of `expr`, considering any `AutoAdjustment`
@@ -2178,21 +2134,21 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2178
2134
/// unless it was to fix it properly, which seemed a distraction from the
2179
2135
/// thread at hand! -nmatsakis
2180
2136
pub fn expr_ty_adjusted ( self , expr : & hir:: Expr ) -> Ty < ' gcx > {
2181
- self . expr_ty ( expr)
2137
+ self . tables ( ) . expr_ty ( expr)
2182
2138
. adjust ( self . global_tcx ( ) , expr. span , expr. id ,
2183
- self . tables . borrow ( ) . adjustments . get ( & expr. id ) ,
2139
+ self . tables ( ) . adjustments . get ( & expr. id ) ,
2184
2140
|method_call| {
2185
- self . tables . borrow ( ) . method_map . get ( & method_call) . map ( |method| method. ty )
2141
+ self . tables ( ) . method_map . get ( & method_call) . map ( |method| method. ty )
2186
2142
} )
2187
2143
}
2188
2144
2189
2145
pub fn expr_ty_adjusted_opt ( self , expr : & hir:: Expr ) -> Option < Ty < ' gcx > > {
2190
- self . expr_ty_opt ( expr) . map ( |t| t. adjust ( self . global_tcx ( ) ,
2146
+ self . tables ( ) . expr_ty_opt ( expr) . map ( |t| t. adjust ( self . global_tcx ( ) ,
2191
2147
expr. span ,
2192
2148
expr. id ,
2193
- self . tables . borrow ( ) . adjustments . get ( & expr. id ) ,
2149
+ self . tables ( ) . adjustments . get ( & expr. id ) ,
2194
2150
|method_call| {
2195
- self . tables . borrow ( ) . method_map . get ( & method_call) . map ( |method| method. ty )
2151
+ self . tables ( ) . method_map . get ( & method_call) . map ( |method| method. ty )
2196
2152
} ) )
2197
2153
}
2198
2154
@@ -2908,19 +2864,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
2908
2864
self . mk_region ( ty:: ReScope ( self . region_maps . node_extent ( id) ) )
2909
2865
}
2910
2866
2911
- pub fn is_method_call ( self , expr_id : NodeId ) -> bool {
2912
- self . tables . borrow ( ) . method_map . contains_key ( & MethodCall :: expr ( expr_id) )
2913
- }
2914
-
2915
- pub fn is_overloaded_autoderef ( self , expr_id : NodeId , autoderefs : u32 ) -> bool {
2916
- self . tables . borrow ( ) . method_map . contains_key ( & MethodCall :: autoderef ( expr_id,
2917
- autoderefs) )
2918
- }
2919
-
2920
- pub fn upvar_capture ( self , upvar_id : ty:: UpvarId ) -> Option < ty:: UpvarCapture < ' tcx > > {
2921
- Some ( self . tables . borrow ( ) . upvar_capture_map . get ( & upvar_id) . unwrap ( ) . clone ( ) )
2922
- }
2923
-
2924
2867
pub fn visit_all_items_in_krate < V , F > ( self ,
2925
2868
dep_node_fn : F ,
2926
2869
visitor : & mut V )
0 commit comments