@@ -27,7 +27,7 @@ use rustc::util::nodemap::{DefIdSet};
27
27
28
28
use super :: simplify:: { remove_dead_blocks, CfgSimplifier } ;
29
29
30
- use syntax:: attr;
30
+ use syntax:: { attr} ;
31
31
use syntax:: abi:: Abi ;
32
32
33
33
use callgraph;
@@ -184,6 +184,9 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
184
184
let callsite = callsites[ csi] ;
185
185
csi += 1 ;
186
186
187
+ let _task = self . tcx . dep_graph . in_task ( DepNode :: Mir ( callsite. caller ) ) ;
188
+ self . tcx . dep_graph . write ( DepNode :: Mir ( callsite. caller ) ) ;
189
+
187
190
let callee_mir = {
188
191
if let Some ( callee_mir) = self . tcx . maybe_item_mir ( callsite. callee ) {
189
192
if !self . should_inline ( callsite, & callee_mir) {
@@ -232,7 +235,6 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
232
235
}
233
236
}
234
237
235
-
236
238
csi -= 1 ;
237
239
if scc. len ( ) == 1 {
238
240
callsites. swap_remove ( csi) ;
@@ -251,6 +253,9 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
251
253
252
254
// Simplify functions we inlined into.
253
255
for def_id in inlined_into {
256
+ let _task = self . tcx . dep_graph . in_task ( DepNode :: Mir ( def_id) ) ;
257
+ self . tcx . dep_graph . write ( DepNode :: Mir ( def_id) ) ;
258
+
254
259
let mut caller_mir = {
255
260
let map = self . tcx . maps . mir . borrow ( ) ;
256
261
let mir = map. get ( & def_id) . unwrap ( ) ;
@@ -275,11 +280,6 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
275
280
return false ;
276
281
}
277
282
278
- // Don't inline calls to trait methods
279
- // FIXME: Should try to resolve it to a concrete method, and
280
- // only bail if that isn't possible
281
- let trait_def = tcx. trait_of_item ( callsite. callee ) ;
282
- if trait_def. is_some ( ) { return false ; }
283
283
284
284
let attrs = tcx. get_attrs ( callsite. callee ) ;
285
285
let hint = attr:: find_inline_attr ( None , & attrs[ ..] ) ;
@@ -294,19 +294,13 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
294
294
attr:: InlineAttr :: None => false ,
295
295
} ;
296
296
297
- // Only inline local functions if they would be eligible for
298
- // cross-crate inlining. This ensures that any symbols they
299
- // use are reachable cross-crate
300
- // FIXME(#36594): This shouldn't be necessary, and is more conservative
301
- // than it could be, but trans should generate the reachable set from
302
- // the MIR anyway, making any check obsolete.
297
+ // Only inline local functions if they would be eligible for cross-crate
298
+ // inlining. This is to ensure that the final crate doesn't have MIR that
299
+ // reference unexported symbols
303
300
if callsite. callee . is_local ( ) {
304
- // No type substs and no inline hint means this function
305
- // wouldn't be eligible for cross-crate inlining
306
301
if callsite. substs . types ( ) . count ( ) == 0 && !hinted {
307
302
return false ;
308
303
}
309
-
310
304
}
311
305
312
306
let mut threshold = if hinted {
0 commit comments