about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2017-07-19 11:28:35 -0700
committerRalf Jung <post@ralfj.de>2017-07-19 11:28:35 -0700
commit72664e42aa1f66ac57891cc45f80cc925e261c19 (patch)
treeb8aba122fc516d1affae3b27b1f8e2f04e7531c5 /src
parent2d5c4196f17fc8d09ac2c434f2a49cdb07e7f4bc (diff)
downloadrust-72664e42aa1f66ac57891cc45f80cc925e261c19.tar.gz
rust-72664e42aa1f66ac57891cc45f80cc925e261c19.zip
No longer check aligment and non-NULLness on `&`
This breaks creating unaligned raw pointers via `&packed.field as *const _`, which needs to be legal.
Also it doesn't seem like LLVM still relies on this, see
* https://github.com/solson/miri/issues/244#issuecomment-315563640
* https://internals.rust-lang.org/t/rules-for-alignment-and-non-nullness-of-references/5430/16

We probably want to handle this invariant like the others that validation is concerned with, and only
check it on function boundaries for now.
Diffstat (limited to 'src')
-rw-r--r--src/eval_context.rs4
1 files changed, 0 insertions, 4 deletions
diff --git a/src/eval_context.rs b/src/eval_context.rs
index 2f28063ff86..ff09e5db949 100644
--- a/src/eval_context.rs
+++ b/src/eval_context.rs
@@ -682,10 +682,6 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
                         bug!("attempted to take a reference to an enum downcast lvalue"),
                 };
 
-                // Check alignment and non-NULLness.
-                let (_, align) = self.size_and_align_of_dst(ty, val)?;
-                self.memory.check_align(ptr, align)?;
-
                 self.write_value(val, dest, dest_ty)?;
             }