@@ -16,7 +16,6 @@ use rustc::hir;
16
16
use rustc:: hir:: def_id:: DefId ;
17
17
use rustc:: middle:: region;
18
18
use rustc:: mir:: * ;
19
- use rustc:: mir:: transform:: MirSource ;
20
19
use rustc:: mir:: visit:: { MutVisitor , TyContext } ;
21
20
use rustc:: ty:: { self , Ty , TyCtxt } ;
22
21
use rustc:: ty:: subst:: Substs ;
@@ -30,6 +29,7 @@ use syntax::abi::Abi;
30
29
use syntax:: ast;
31
30
use syntax:: symbol:: keywords;
32
31
use syntax_pos:: Span ;
32
+ use transform:: MirSource ;
33
33
use util as mir_util;
34
34
35
35
/// 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
83
83
_ => unsupported ( ) ,
84
84
} ;
85
85
86
- let src = MirSource :: from_node ( tcx, id) ;
87
86
tcx. infer_ctxt ( ) . enter ( |infcx| {
88
- let cx = Cx :: new ( & infcx, src ) ;
87
+ let cx = Cx :: new ( & infcx, id ) ;
89
88
let mut mir = if cx. tables ( ) . tainted_by_errors {
90
89
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 {
92
91
// fetch the fully liberated fn signature (that is, all bound
93
92
// types/lifetimes replaced)
94
93
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
150
149
mem:: transmute :: < Mir , Mir < ' tcx > > ( mir)
151
150
} ;
152
151
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 ( ( ) ) ) ;
154
154
155
155
mir
156
156
} )
@@ -214,8 +214,7 @@ fn create_constructor_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
214
214
let span = tcx. hir . span ( ctor_id) ;
215
215
if let hir:: VariantData :: Tuple ( ref fields, ctor_id) = * v {
216
216
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) ;
219
218
220
219
// Convert the Mir to global types.
221
220
let tcx = infcx. tcx . global_tcx ( ) ;
@@ -228,7 +227,9 @@ fn create_constructor_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
228
227
mem:: transmute :: < Mir , Mir < ' tcx > > ( mir)
229
228
} ;
230
229
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 ( ( ) ) ) ;
232
233
233
234
mir
234
235
} )
0 commit comments