@@ -939,7 +939,8 @@ impl EncodeContext<'tcx> {
939939 record ! ( self . tables. kind[ def_id] <- match impl_item. kind {
940940 ty:: AssocKind :: Const => {
941941 if let hir:: ImplItemKind :: Const ( _, body_id) = ast_item. kind {
942- let qualifs = self . tcx. at( ast_item. span) . mir_const_qualif( def_id) ;
942+ let tcx = self . tcx. at( ast_item. span) ;
943+ let qualifs = tcx. mir_const_qualif( tcx. with_opt_param( def_id) ) ;
943944
944945 EntryKind :: AssocConst (
945946 container,
@@ -1021,14 +1022,18 @@ impl EncodeContext<'tcx> {
10211022 fn encode_optimized_mir ( & mut self , def_id : LocalDefId ) {
10221023 debug ! ( "EntryBuilder::encode_mir({:?})" , def_id) ;
10231024 if self . tcx . mir_keys ( LOCAL_CRATE ) . contains ( & def_id) {
1024- record ! ( self . tables. mir[ def_id. to_def_id( ) ] <- self . tcx. optimized_mir( def_id) ) ;
1025+ record ! ( self . tables. mir[ def_id. to_def_id( ) ] <- self . tcx. optimized_mir(
1026+ self . tcx. with_opt_param( def_id. to_def_id( ) )
1027+ ) ) ;
10251028 }
10261029 }
10271030
10281031 fn encode_promoted_mir ( & mut self , def_id : LocalDefId ) {
10291032 debug ! ( "EncodeContext::encode_promoted_mir({:?})" , def_id) ;
10301033 if self . tcx . mir_keys ( LOCAL_CRATE ) . contains ( & def_id) {
1031- record ! ( self . tables. promoted_mir[ def_id. to_def_id( ) ] <- self . tcx. promoted_mir( def_id) ) ;
1034+ record ! ( self . tables. promoted_mir[ def_id. to_def_id( ) ] <- self . tcx. promoted_mir(
1035+ self . tcx. with_opt_param( def_id. to_def_id( ) )
1036+ ) ) ;
10321037 }
10331038 }
10341039
@@ -1086,7 +1091,8 @@ impl EncodeContext<'tcx> {
10861091 hir:: ItemKind :: Static ( _, hir:: Mutability :: Mut , _) => EntryKind :: MutStatic ,
10871092 hir:: ItemKind :: Static ( _, hir:: Mutability :: Not , _) => EntryKind :: ImmStatic ,
10881093 hir:: ItemKind :: Const ( _, body_id) => {
1089- let qualifs = self . tcx. at( item. span) . mir_const_qualif( def_id) ;
1094+ let tcx = self . tcx. at( item. span) ;
1095+ let qualifs = tcx. mir_const_qualif( tcx. with_opt_param( def_id) ) ;
10901096 EntryKind :: Const (
10911097 qualifs,
10921098 self . encode_rendered_const_for_body( body_id)
@@ -1328,7 +1334,7 @@ impl EncodeContext<'tcx> {
13281334 // NOTE(eddyb) `tcx.type_of(def_id)` isn't used because it's fully generic,
13291335 // including on the signature, which is inferred in `typeck_tables_of.
13301336 let hir_id = self . tcx . hir ( ) . as_local_hir_id ( def_id) ;
1331- let ty = self . tcx . typeck_tables_of ( def_id) . node_type ( hir_id) ;
1337+ let ty = self . tcx . typeck_tables_of ( self . tcx . with_opt_param ( def_id) ) . node_type ( hir_id) ;
13321338
13331339 record ! ( self . tables. kind[ def_id. to_def_id( ) ] <- match ty. kind {
13341340 ty:: Generator ( ..) => {
@@ -1357,7 +1363,7 @@ impl EncodeContext<'tcx> {
13571363 let id = self . tcx . hir ( ) . as_local_hir_id ( def_id) ;
13581364 let body_id = self . tcx . hir ( ) . body_owned_by ( id) ;
13591365 let const_data = self . encode_rendered_const_for_body ( body_id) ;
1360- let qualifs = self . tcx . mir_const_qualif ( def_id) ;
1366+ let qualifs = self . tcx . mir_const_qualif ( self . tcx . with_opt_param ( def_id. to_def_id ( ) ) ) ;
13611367
13621368 record ! ( self . tables. kind[ def_id. to_def_id( ) ] <- EntryKind :: AnonConst ( qualifs, const_data) ) ;
13631369 record ! ( self . tables. visibility[ def_id. to_def_id( ) ] <- ty:: Visibility :: Public ) ;
@@ -1744,8 +1750,9 @@ struct PrefetchVisitor<'tcx> {
17441750impl < ' tcx > PrefetchVisitor < ' tcx > {
17451751 fn prefetch_mir ( & self , def_id : LocalDefId ) {
17461752 if self . mir_keys . contains ( & def_id) {
1747- self . tcx . ensure ( ) . optimized_mir ( def_id) ;
1748- self . tcx . ensure ( ) . promoted_mir ( def_id) ;
1753+ let def = self . tcx . with_opt_param ( def_id) . to_global ( ) ;
1754+ self . tcx . ensure ( ) . optimized_mir ( def) ;
1755+ self . tcx . ensure ( ) . promoted_mir ( def) ;
17491756 }
17501757 }
17511758}
0 commit comments