@@ -15,7 +15,7 @@ use rustc_middle::mir::interpret::{alloc_range, AllocId};
1515use rustc_middle:: ty:: { self , Ty , TyCtxt , Variance } ;
1616use rustc_span:: def_id:: { CrateNum , DefId , LOCAL_CRATE } ;
1717use rustc_target:: abi:: FieldIdx ;
18- use stable_mir:: mir:: { CopyNonOverlapping , UserTypeProjection , VariantIdx } ;
18+ use stable_mir:: mir:: { CopyNonOverlapping , Statement , UserTypeProjection , VariantIdx } ;
1919use stable_mir:: ty:: { FloatTy , GenericParamDef , IntTy , Movability , RigidTy , Span , TyKind , UintTy } ;
2020use stable_mir:: { self , opaque, Context } ;
2121use tracing:: debug;
@@ -232,39 +232,74 @@ impl<'tcx> Stable<'tcx> for mir::Statement<'tcx> {
232232 fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
233233 use rustc_middle:: mir:: StatementKind :: * ;
234234 match & self . kind {
235- Assign ( assign) => {
236- stable_mir:: mir:: Statement :: Assign ( assign. 0 . stable ( tables) , assign. 1 . stable ( tables) )
237- }
238- FakeRead ( fake_read_place) => stable_mir:: mir:: Statement :: FakeRead (
239- fake_read_place. 0 . stable ( tables) ,
240- fake_read_place. 1 . stable ( tables) ,
241- ) ,
242- SetDiscriminant { place : plc, variant_index : idx } => {
243- stable_mir:: mir:: Statement :: SetDiscriminant {
235+ Assign ( assign) => Statement {
236+ kind : stable_mir:: mir:: StatementKind :: Assign (
237+ assign. 0 . stable ( tables) ,
238+ assign. 1 . stable ( tables) ,
239+ ) ,
240+ span : self . source_info . span . stable ( tables) ,
241+ } ,
242+ FakeRead ( fake_read_place) => Statement {
243+ kind : stable_mir:: mir:: StatementKind :: FakeRead (
244+ fake_read_place. 0 . stable ( tables) ,
245+ fake_read_place. 1 . stable ( tables) ,
246+ ) ,
247+ span : self . source_info . span . stable ( tables) ,
248+ } ,
249+ SetDiscriminant { place : plc, variant_index : idx } => Statement {
250+ kind : stable_mir:: mir:: StatementKind :: SetDiscriminant {
244251 place : plc. as_ref ( ) . stable ( tables) ,
245252 variant_index : idx. stable ( tables) ,
246- }
247- }
248- Deinit ( place) => stable_mir:: mir:: Statement :: Deinit ( place. stable ( tables) ) ,
249- StorageLive ( place) => stable_mir:: mir:: Statement :: StorageLive ( place. stable ( tables) ) ,
250- StorageDead ( place) => stable_mir:: mir:: Statement :: StorageDead ( place. stable ( tables) ) ,
251- Retag ( retag, place) => {
252- stable_mir:: mir:: Statement :: Retag ( retag. stable ( tables) , place. stable ( tables) )
253- }
254- PlaceMention ( place) => stable_mir:: mir:: Statement :: PlaceMention ( place. stable ( tables) ) ,
255- AscribeUserType ( place_projection, variance) => {
256- stable_mir:: mir:: Statement :: AscribeUserType {
253+ } ,
254+ span : self . source_info . span . stable ( tables) ,
255+ } ,
256+ Deinit ( place) => Statement {
257+ kind : stable_mir:: mir:: StatementKind :: Deinit ( place. stable ( tables) ) ,
258+ span : self . source_info . span . stable ( tables) ,
259+ } ,
260+ StorageLive ( place) => Statement {
261+ kind : stable_mir:: mir:: StatementKind :: StorageLive ( place. stable ( tables) ) ,
262+ span : self . source_info . span . stable ( tables) ,
263+ } ,
264+ StorageDead ( place) => Statement {
265+ kind : stable_mir:: mir:: StatementKind :: StorageDead ( place. stable ( tables) ) ,
266+ span : self . source_info . span . stable ( tables) ,
267+ } ,
268+ Retag ( retag, place) => Statement {
269+ kind : stable_mir:: mir:: StatementKind :: Retag (
270+ retag. stable ( tables) ,
271+ place. stable ( tables) ,
272+ ) ,
273+ span : self . source_info . span . stable ( tables) ,
274+ } ,
275+ PlaceMention ( place) => Statement {
276+ kind : stable_mir:: mir:: StatementKind :: PlaceMention ( place. stable ( tables) ) ,
277+ span : self . source_info . span . stable ( tables) ,
278+ } ,
279+ AscribeUserType ( place_projection, variance) => Statement {
280+ kind : stable_mir:: mir:: StatementKind :: AscribeUserType {
257281 place : place_projection. as_ref ( ) . 0 . stable ( tables) ,
258282 projections : place_projection. as_ref ( ) . 1 . stable ( tables) ,
259283 variance : variance. stable ( tables) ,
260- }
261- }
262- Coverage ( coverage) => stable_mir:: mir:: Statement :: Coverage ( opaque ( coverage) ) ,
263- Intrinsic ( intrinstic) => {
264- stable_mir:: mir:: Statement :: Intrinsic ( intrinstic. stable ( tables) )
265- }
266- ConstEvalCounter => stable_mir:: mir:: Statement :: ConstEvalCounter ,
267- Nop => stable_mir:: mir:: Statement :: Nop ,
284+ } ,
285+ span : self . source_info . span . stable ( tables) ,
286+ } ,
287+ Coverage ( coverage) => Statement {
288+ kind : stable_mir:: mir:: StatementKind :: Coverage ( opaque ( coverage) ) ,
289+ span : self . source_info . span . stable ( tables) ,
290+ } ,
291+ Intrinsic ( intrinstic) => Statement {
292+ kind : stable_mir:: mir:: StatementKind :: Intrinsic ( intrinstic. stable ( tables) ) ,
293+ span : self . source_info . span . stable ( tables) ,
294+ } ,
295+ ConstEvalCounter => Statement {
296+ kind : stable_mir:: mir:: StatementKind :: ConstEvalCounter ,
297+ span : self . source_info . span . stable ( tables) ,
298+ } ,
299+ Nop => Statement {
300+ kind : stable_mir:: mir:: StatementKind :: Nop ,
301+ span : self . source_info . span . stable ( tables) ,
302+ } ,
268303 }
269304 }
270305}
0 commit comments