about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/messages.ftl
diff options
context:
space:
mode:
authorVeera <sveera.2001@gmail.com>2024-09-22 19:32:56 -0400
committerVeera <sveera.2001@gmail.com>2024-10-05 12:48:02 +0000
commitab8673501ce13573c06b5989b179f5cfed85c771 (patch)
tree69ee6acefc3ed99efe7f86deb6b89ab0f97c424a /compiler/rustc_mir_transform/messages.ftl
parent5d9b908571ed61679f2a12eaae7e032cdabbb8be (diff)
downloadrust-ab8673501ce13573c06b5989b179f5cfed85c771.tar.gz
rust-ab8673501ce13573c06b5989b179f5cfed85c771.zip
Add a Lint for Pointer to Integer Transmutes in Consts
Diffstat (limited to 'compiler/rustc_mir_transform/messages.ftl')
-rw-r--r--compiler/rustc_mir_transform/messages.ftl5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/messages.ftl b/compiler/rustc_mir_transform/messages.ftl
index f9b79d72b05..b81c0906734 100644
--- a/compiler/rustc_mir_transform/messages.ftl
+++ b/compiler/rustc_mir_transform/messages.ftl
@@ -27,3 +27,8 @@ mir_transform_unaligned_packed_ref = reference to packed field is unaligned
     .note = packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
     .note_ub = creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
     .help = copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
+
+mir_transform_undefined_transmute = pointers cannot be transmuted to integers during const eval
+    .note = at compile-time, pointers do not have an integer value
+    .note2 = avoiding this restriction via `union` or raw pointers leads to compile-time undefined behavior
+    .help = for more information, see https://doc.rust-lang.org/std/mem/fn.transmute.html