RS.CLIPPY.WRONG_TRANSMUTE

Transmutes that are confusing at best, undefined behavior at worst and always useless

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: wrong_transmute. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for transmutes that can't ever be correct on any architecture.

Why is this bad?

It's basically guaranteed to be undefined behavior.

Known problems

When accessing C, users might want to store pointer sized objects in extradata arguments to save an allocation.

Example

let ptr: *const T = core::intrinsics::transmute(\'x\')