@@ -52,7 +52,7 @@ can be broken down into several distinct phases:
5252
5353While type checking a function, the intermediate types for the
5454expressions, blocks, and so forth contained within the function are
55- stored in `fcx.node_types` and `fcx.item_substs `. These types
55+ stored in `fcx.node_types` and `fcx.node_substs `. These types
5656may contain unresolved type variables. After type checking is
5757complete, the functions in the writeback module are used to take the
5858types from this table, resolve them, and then write them into their
@@ -1758,14 +1758,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
17581758 }
17591759 }
17601760
1761- pub fn write_substs ( & self , node_id : ast:: NodeId , substs : ty :: ItemSubsts < ' tcx > ) {
1762- if !substs. substs . is_noop ( ) {
1761+ pub fn write_substs ( & self , node_id : ast:: NodeId , substs : & ' tcx Substs < ' tcx > ) {
1762+ if !substs. is_noop ( ) {
17631763 debug ! ( "write_substs({}, {:?}) in fcx {}" ,
17641764 node_id,
17651765 substs,
17661766 self . tag( ) ) ;
17671767
1768- self . tables . borrow_mut ( ) . item_substs . insert ( node_id, substs) ;
1768+ self . tables . borrow_mut ( ) . node_substs . insert ( node_id, substs) ;
17691769 }
17701770 }
17711771
@@ -1959,16 +1959,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
19591959 }
19601960 }
19611961
1962- pub fn opt_node_ty_substs < F > ( & self ,
1963- id : ast:: NodeId ,
1964- f : F ) where
1965- F : FnOnce ( & ty:: ItemSubsts < ' tcx > ) ,
1966- {
1967- if let Some ( s) = self . tables . borrow ( ) . item_substs . get ( & id) {
1968- f ( s) ;
1969- }
1970- }
1971-
19721962 /// Registers an obligation for checking later, during regionck, that the type `ty` must
19731963 /// outlive the region `r`.
19741964 pub fn register_region_obligation ( & self ,
@@ -3550,9 +3540,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
35503540
35513541 // We always require that the type provided as the value for
35523542 // a type parameter outlives the moment of instantiation.
3553- self . opt_node_ty_substs ( expr. id , |item_substs| {
3554- self . add_wf_bounds ( & item_substs. substs , expr) ;
3555- } ) ;
3543+ let substs = self . tables . borrow ( ) . node_substs ( expr. id ) ;
3544+ self . add_wf_bounds ( substs, expr) ;
35563545
35573546 ty
35583547 }
@@ -4375,9 +4364,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
43754364 let ty = self . local_ty ( span, nid) ;
43764365 let ty = self . normalize_associated_types_in ( span, & ty) ;
43774366 self . write_ty ( node_id, ty) ;
4378- self . write_substs ( node_id, ty:: ItemSubsts {
4379- substs : self . tcx . intern_substs ( & [ ] )
4380- } ) ;
43814367 return ty;
43824368 }
43834369 _ => { }
@@ -4509,9 +4495,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
45094495 debug ! ( "instantiate_value_path: type of {:?} is {:?}" ,
45104496 node_id,
45114497 ty_substituted) ;
4512- self . write_substs ( node_id, ty:: ItemSubsts {
4513- substs : substs
4514- } ) ;
4498+ self . write_substs ( node_id, substs) ;
45154499 ty_substituted
45164500 }
45174501
0 commit comments