Skip to main content

is_box_deref_cast

Function is_box_deref_cast 

Source
fn is_box_deref_cast(
    tcx: TyCtxt<'_>,
    body: &Body<'_>,
    rvalue: &Rvalue<'_>,
) -> bool
Expand description

Whether rvalue is the compiler’s lowering of the safe *box deref.

On recent nightlies the compiler tags this cast BoxDerefTransmute — a precise, dedicated marker, so match it exactly and never treat other casts of a Box-typed local (e.g. transmute::<Box<T>, *mut T>) as safe. On older toolchains that lower *box to a plain Transmute of the Unique/NonNull field, fall back to checking the cast source base local’s type.