@@ -16,7 +16,6 @@ use rustc::hir;
1616use rustc:: hir:: def_id:: DefId ;
1717use rustc:: middle:: region;
1818use rustc:: mir:: * ;
19- use rustc:: mir:: transform:: MirSource ;
2019use rustc:: mir:: visit:: { MutVisitor , TyContext } ;
2120use rustc:: ty:: { self , Ty , TyCtxt } ;
2221use rustc:: ty:: subst:: Substs ;
@@ -30,6 +29,7 @@ use syntax::abi::Abi;
3029use syntax:: ast;
3130use syntax:: symbol:: keywords;
3231use syntax_pos:: Span ;
32+ use transform:: MirSource ;
3333use util as mir_util;
3434
3535/// Construct the MIR for a given def-id.
@@ -83,12 +83,11 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t
8383 _ => unsupported ( ) ,
8484 } ;
8585
86- let src = MirSource :: from_node ( tcx, id) ;
8786 tcx. infer_ctxt ( ) . enter ( |infcx| {
88- let cx = Cx :: new ( & infcx, src ) ;
87+ let cx = Cx :: new ( & infcx, id ) ;
8988 let mut mir = if cx. tables ( ) . tainted_by_errors {
9089 build:: construct_error ( cx, body_id)
91- } else if let MirSource :: Fn ( id ) = src {
90+ } else if let hir :: BodyOwnerKind :: Fn = cx . body_owner_kind {
9291 // fetch the fully liberated fn signature (that is, all bound
9392 // types/lifetimes replaced)
9493 let fn_hir_id = tcx. hir . node_to_hir_id ( id) ;
@@ -150,7 +149,8 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t
150149 mem:: transmute :: < Mir , Mir < ' tcx > > ( mir)
151150 } ;
152151
153- mir_util:: dump_mir ( tcx, None , "mir_map" , & 0 , src, & mir, |_, _| Ok ( ( ) ) ) ;
152+ mir_util:: dump_mir ( tcx, None , "mir_map" , & 0 ,
153+ MirSource :: item ( def_id) , & mir, |_, _| Ok ( ( ) ) ) ;
154154
155155 mir
156156 } )
@@ -214,8 +214,7 @@ fn create_constructor_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
214214 let span = tcx. hir . span ( ctor_id) ;
215215 if let hir:: VariantData :: Tuple ( ref fields, ctor_id) = * v {
216216 tcx. infer_ctxt ( ) . enter ( |infcx| {
217- let ( mut mir, src) =
218- shim:: build_adt_ctor ( & infcx, ctor_id, fields, span) ;
217+ let mut mir = shim:: build_adt_ctor ( & infcx, ctor_id, fields, span) ;
219218
220219 // Convert the Mir to global types.
221220 let tcx = infcx. tcx . global_tcx ( ) ;
@@ -228,7 +227,9 @@ fn create_constructor_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
228227 mem:: transmute :: < Mir , Mir < ' tcx > > ( mir)
229228 } ;
230229
231- mir_util:: dump_mir ( tcx, None , "mir_map" , & 0 , src, & mir, |_, _| Ok ( ( ) ) ) ;
230+ mir_util:: dump_mir ( tcx, None , "mir_map" , & 0 ,
231+ MirSource :: item ( tcx. hir . local_def_id ( ctor_id) ) ,
232+ & mir, |_, _| Ok ( ( ) ) ) ;
232233
233234 mir
234235 } )
0 commit comments