]> git.lizzy.rs Git - rust.git/blobdiff - src/shims/mod.rs
Auto merge of #2141 - saethlin:early-diagnostics-ice, r=RalfJung
[rust.git] / src / shims / mod.rs
index 66f673d241d363c61887917f47ce03704639a7e5..f003552434fe9a5c0548165c44dfa476f67c9106 100644 (file)
@@ -36,7 +36,7 @@ fn find_mir_or_eval_fn(
 
         // There are some more lang items we want to hook that CTFE does not hook (yet).
         if this.tcx.lang_items().align_offset_fn() == Some(instance.def.def_id()) {
-            let &[ref ptr, ref align] = check_arg_count(args)?;
+            let [ptr, align] = check_arg_count(args)?;
             if this.align_offset(ptr, align, ret, unwind)? {
                 return Ok(None);
             }
@@ -69,7 +69,7 @@ fn align_offset(
         let this = self.eval_context_mut();
         let (dest, ret) = ret.unwrap();
 
-        if this.memory.extra.check_alignment != AlignmentCheck::Symbolic {
+        if this.machine.check_alignment != AlignmentCheck::Symbolic {
             // Just use actual implementation.
             return Ok(false);
         }
@@ -83,10 +83,9 @@ fn align_offset(
         }
 
         let ptr = this.read_pointer(ptr_op)?;
-        if let Ok(ptr) = ptr.into_pointer_or_addr() {
+        if let Ok((alloc_id, _offset, _)) = this.ptr_try_get_alloc_id(ptr) {
             // Only do anything if we can identify the allocation this goes to.
-            let (_, cur_align) =
-                this.memory.get_size_and_align(ptr.provenance.alloc_id, AllocCheck::MaybeDead)?;
+            let (_, cur_align) = this.get_alloc_size_and_align(alloc_id, AllocCheck::MaybeDead)?;
             if cur_align.bytes() >= req_align {
                 // If the allocation alignment is at least the required alignment we use the
                 // real implementation.