Skip to content

Reads of undef memory must not cause the behavior to be undefined in general. #30500

@mahkoh

Description

@mahkoh

The following is a list of behavior which is forbidden in all Rust code

  • Reads of undef (uninitialized) memory

This cannot be because memcpy will read padding bytes which are undef. It's also not true in practice because in

let x: u8 = undef;
let y: u16 = x as u16 + 0xab00;
let z: u16 = y & 0xff00;

z will be 0xab00 and not undef.

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