@@ -10,13 +10,14 @@ use std::time::Instant;
1010use rand:: rngs:: StdRng ;
1111use rand:: SeedableRng ;
1212
13+ use rustc_ast:: ast:: Mutability ;
1314use rustc_data_structures:: fx:: FxHashMap ;
1415use rustc_middle:: {
1516 mir,
1617 ty:: {
1718 self ,
1819 layout:: { LayoutCx , LayoutError , LayoutOf , TyAndLayout } ,
19- Instance , TyCtxt ,
20+ Instance , TyCtxt , TypeAndMut ,
2021 } ,
2122} ;
2223use rustc_span:: def_id:: { CrateNum , DefId } ;
@@ -269,19 +270,23 @@ pub struct PrimitiveLayouts<'tcx> {
269270 pub u32 : TyAndLayout < ' tcx > ,
270271 pub usize : TyAndLayout < ' tcx > ,
271272 pub bool : TyAndLayout < ' tcx > ,
273+ pub mut_raw_ptr : TyAndLayout < ' tcx > ,
272274}
273275
274276impl < ' mir , ' tcx : ' mir > PrimitiveLayouts < ' tcx > {
275277 fn new ( layout_cx : LayoutCx < ' tcx , TyCtxt < ' tcx > > ) -> Result < Self , LayoutError < ' tcx > > {
278+ let tcx = layout_cx. tcx ;
279+ let mut_raw_ptr = tcx. mk_ptr ( TypeAndMut { ty : tcx. types . unit , mutbl : Mutability :: Mut } ) ;
276280 Ok ( Self {
277- unit : layout_cx. layout_of ( layout_cx. tcx . mk_unit ( ) ) ?,
278- i8 : layout_cx. layout_of ( layout_cx. tcx . types . i8 ) ?,
279- i32 : layout_cx. layout_of ( layout_cx. tcx . types . i32 ) ?,
280- isize : layout_cx. layout_of ( layout_cx. tcx . types . isize ) ?,
281- u8 : layout_cx. layout_of ( layout_cx. tcx . types . u8 ) ?,
282- u32 : layout_cx. layout_of ( layout_cx. tcx . types . u32 ) ?,
283- usize : layout_cx. layout_of ( layout_cx. tcx . types . usize ) ?,
284- bool : layout_cx. layout_of ( layout_cx. tcx . types . bool ) ?,
281+ unit : layout_cx. layout_of ( tcx. mk_unit ( ) ) ?,
282+ i8 : layout_cx. layout_of ( tcx. types . i8 ) ?,
283+ i32 : layout_cx. layout_of ( tcx. types . i32 ) ?,
284+ isize : layout_cx. layout_of ( tcx. types . isize ) ?,
285+ u8 : layout_cx. layout_of ( tcx. types . u8 ) ?,
286+ u32 : layout_cx. layout_of ( tcx. types . u32 ) ?,
287+ usize : layout_cx. layout_of ( tcx. types . usize ) ?,
288+ bool : layout_cx. layout_of ( tcx. types . bool ) ?,
289+ mut_raw_ptr : layout_cx. layout_of ( mut_raw_ptr) ?,
285290 } )
286291 }
287292}
0 commit comments