@@ -172,7 +172,7 @@ use rustc::ty::{self, Ty, TyCtxt, TypeFoldable, Const};
172
172
use rustc:: ty:: layout:: { Integer , IntegerExt , VariantIdx , Size } ;
173
173
174
174
use rustc:: mir:: Field ;
175
- use rustc:: mir:: interpret:: { ConstValue , Pointer , Scalar } ;
175
+ use rustc:: mir:: interpret:: { ConstValue , Scalar } ;
176
176
use rustc:: util:: common:: ErrorReported ;
177
177
178
178
use syntax:: attr:: { SignedInt , UnsignedInt } ;
@@ -214,9 +214,8 @@ impl<'a, 'tcx> LiteralExpander<'a, 'tcx> {
214
214
match ( val, & crty. sty , & rty. sty ) {
215
215
// the easy case, deref a reference
216
216
( ConstValue :: Scalar ( Scalar :: Ptr ( p) ) , x, y) if x == y => ConstValue :: ByRef (
217
- p. alloc_id ,
217
+ p,
218
218
self . tcx . alloc_map . lock ( ) . unwrap_memory ( p. alloc_id ) ,
219
- p. offset ,
220
219
) ,
221
220
// unsize array to slice if pattern is array but match value or other patterns are slice
222
221
( ConstValue :: Scalar ( Scalar :: Ptr ( p) ) , ty:: Array ( t, n) , ty:: Slice ( u) ) => {
@@ -1428,15 +1427,14 @@ fn slice_pat_covered_by_const<'tcx>(
1428
1427
suffix : & [ Pattern < ' tcx > ]
1429
1428
) -> Result < bool , ErrorReported > {
1430
1429
let data: & [ u8 ] = match ( const_val. val , & const_val. ty . sty ) {
1431
- ( ConstValue :: ByRef ( id , alloc, offset ) , ty:: Array ( t, n) ) => {
1430
+ ( ConstValue :: ByRef ( ptr , alloc) , ty:: Array ( t, n) ) => {
1432
1431
if * t != tcx. types . u8 {
1433
1432
// FIXME(oli-obk): can't mix const patterns with slice patterns and get
1434
1433
// any sort of exhaustiveness/unreachable check yet
1435
1434
// This solely means that we don't lint about unreachable patterns, even if some
1436
1435
// are definitely unreachable.
1437
1436
return Ok ( false ) ;
1438
1437
}
1439
- let ptr = Pointer :: new ( id, offset) ;
1440
1438
let n = n. assert_usize ( tcx) . unwrap ( ) ;
1441
1439
alloc. get_bytes ( & tcx, ptr, Size :: from_bytes ( n) ) . unwrap ( )
1442
1440
} ,
@@ -1778,8 +1776,8 @@ fn specialize<'p, 'a: 'p, 'tcx: 'a>(
1778
1776
let ( opt_ptr, n, ty) = match value. ty . sty {
1779
1777
ty:: TyKind :: Array ( t, n) => {
1780
1778
match value. val {
1781
- ConstValue :: ByRef ( id , alloc, offset ) => (
1782
- Some ( ( Pointer :: new ( id , offset ) , alloc) ) ,
1779
+ ConstValue :: ByRef ( ptr , alloc) => (
1780
+ Some ( ( ptr , alloc) ) ,
1783
1781
n. unwrap_usize ( cx. tcx ) ,
1784
1782
t,
1785
1783
) ,
0 commit comments