about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-10-06 02:39:23 +0000
committerbors <bors@rust-lang.org>2024-10-06 02:39:23 +0000
commitd0507302fcd671c567cc7986fd420215b6625817 (patch)
tree8b3d85a06d79e8ad46b0823dcbc21af3ec69023d /compiler/rustc_codegen_llvm/src
parenta0653c5e9871cf06972438784cbf08e5411b3d9a (diff)
parent98b59a1cf65848d4d9ed036f8663d2ec5e0a8963 (diff)
downloadrust-d0507302fcd671c567cc7986fd420215b6625817.tar.gz
rust-d0507302fcd671c567cc7986fd420215b6625817.zip
Auto merge of #130540 - veera-sivarajan:fix-87525, r=estebank
Add a Lint for Pointer to Integer Transmutes in Consts

Fixes #87525

This PR adds a MirLint for pointer to integer transmutes in const functions and associated consts. The implementation closely follows this comment: https://github.com/rust-lang/rust/pull/85769#issuecomment-880969112. More details about the implementation can be found in the comments.

Note: This could break some sound code as mentioned by RalfJung in https://github.com/rust-lang/rust/pull/85769#issuecomment-886491680:

> ... technically const-code could transmute/cast an int to a ptr and then transmute it back and that would be correct -- so the lint will deny some sound code. Does not seem terribly likely though.

References:
1. https://doc.rust-lang.org/std/mem/fn.transmute.html
2. https://doc.rust-lang.org/reference/items/associated-items.html#associated-constants
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions