Skip to content

transmute_copy doc example is too trivial #31094

Closed
@tomjakubowski

Description

@tomjakubowski

http://doc.rust-lang.org/nightly/std/mem/fn.transmute_copy.html#examples

use std::mem;

let one = unsafe { mem::transmute_copy(&1) };

assert_eq!(1, one);

This transmutes an i32 to... an i32! A more realistic example might be to transmute a byte array to a packed struct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions