@@ -172,7 +172,7 @@ use rustc::ty::{self, Ty, TyCtxt, TypeFoldable, Const};
172172use rustc:: ty:: layout:: { Integer , IntegerExt , VariantIdx , Size } ;
173173
174174use rustc:: mir:: Field ;
175- use rustc:: mir:: interpret:: { ConstValue , Pointer , Scalar } ;
175+ use rustc:: mir:: interpret:: { ConstValue , Scalar } ;
176176use rustc:: util:: common:: ErrorReported ;
177177
178178use syntax:: attr:: { SignedInt , UnsignedInt } ;
@@ -214,9 +214,8 @@ impl<'a, 'tcx> LiteralExpander<'a, 'tcx> {
214214 match ( val, & crty. sty , & rty. sty ) {
215215 // the easy case, deref a reference
216216 ( ConstValue :: Scalar ( Scalar :: Ptr ( p) ) , x, y) if x == y => ConstValue :: ByRef (
217- p. alloc_id ,
217+ p,
218218 self . tcx . alloc_map . lock ( ) . unwrap_memory ( p. alloc_id ) ,
219- p. offset ,
220219 ) ,
221220 // unsize array to slice if pattern is array but match value or other patterns are slice
222221 ( ConstValue :: Scalar ( Scalar :: Ptr ( p) ) , ty:: Array ( t, n) , ty:: Slice ( u) ) => {
@@ -1428,15 +1427,14 @@ fn slice_pat_covered_by_const<'tcx>(
14281427 suffix : & [ Pattern < ' tcx > ]
14291428) -> Result < bool , ErrorReported > {
14301429 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) ) => {
14321431 if * t != tcx. types . u8 {
14331432 // FIXME(oli-obk): can't mix const patterns with slice patterns and get
14341433 // any sort of exhaustiveness/unreachable check yet
14351434 // This solely means that we don't lint about unreachable patterns, even if some
14361435 // are definitely unreachable.
14371436 return Ok ( false ) ;
14381437 }
1439- let ptr = Pointer :: new ( id, offset) ;
14401438 let n = n. assert_usize ( tcx) . unwrap ( ) ;
14411439 alloc. get_bytes ( & tcx, ptr, Size :: from_bytes ( n) ) . unwrap ( )
14421440 } ,
@@ -1778,8 +1776,8 @@ fn specialize<'p, 'a: 'p, 'tcx: 'a>(
17781776 let ( opt_ptr, n, ty) = match value. ty . sty {
17791777 ty:: TyKind :: Array ( t, n) => {
17801778 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) ) ,
17831781 n. unwrap_usize ( cx. tcx ) ,
17841782 t,
17851783 ) ,
0 commit comments