@@ -10,13 +10,14 @@ use std::time::Instant;
10
10
use rand:: rngs:: StdRng ;
11
11
use rand:: SeedableRng ;
12
12
13
+ use rustc_ast:: ast:: Mutability ;
13
14
use rustc_data_structures:: fx:: FxHashMap ;
14
15
use rustc_middle:: {
15
16
mir,
16
17
ty:: {
17
18
self ,
18
19
layout:: { LayoutCx , LayoutError , LayoutOf , TyAndLayout } ,
19
- Instance , TyCtxt ,
20
+ Instance , TyCtxt , TypeAndMut ,
20
21
} ,
21
22
} ;
22
23
use rustc_span:: def_id:: { CrateNum , DefId } ;
@@ -269,19 +270,23 @@ pub struct PrimitiveLayouts<'tcx> {
269
270
pub u32 : TyAndLayout < ' tcx > ,
270
271
pub usize : TyAndLayout < ' tcx > ,
271
272
pub bool : TyAndLayout < ' tcx > ,
273
+ pub mut_raw_ptr : TyAndLayout < ' tcx > ,
272
274
}
273
275
274
276
impl < ' mir , ' tcx : ' mir > PrimitiveLayouts < ' tcx > {
275
277
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 } ) ;
276
280
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) ?,
285
290
} )
286
291
}
287
292
}
0 commit comments