Skip to content

Mark AsciiStr #[repr(transparent)] ? #65

@MaulingMonkey

Description

@MaulingMonkey

I'm unsure if even the non-mut AsciiStr <-> [AsciiChar] slice transmutes like this one here are sound, since you generally can't assume that the outer type is compatible with the inner type without using #[repr(transparent)]:

rust-ascii/src/ascii_str.rs

Lines 350 to 353 in 296c3a8

fn from(slice: &[AsciiChar]) -> &AsciiStr {
let ptr = slice as *const [AsciiChar] as *const AsciiStr;
unsafe { &*ptr }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions