Skip to content

Add sound implementation of Bytes for &[u8] #308

Closed

Description

@Thomasdezeeuw

See rust-lang/rfcs#2930 (comment) and rust-lang/rfcs#2930 (comment).

Example:

let mut buf = [0u8];
let maybe = unsafe { &mut *((&mut buf) as *mut [u8] as *mut [MaybeUninit<u8>]) };
// After this line `buf` will contain uninitialized value, which is UB
maybe[0] = MaybeUninit::uninit();

Activity

  1. Thomasdezeeuw commented on Oct 18, 2020

    @Thomasdezeeuw
    OwnerAuthor

    This should also revert all the changes in the tests/docs from 4f8731c.

  2. changed the title [-]Bytes::as_bytes implementation for &[u8] is unsound[/-] [+]Add sound implementation of Bytes for &[u8][/+] on Nov 23, 2020
  3. added
    enhancementAn improvement of the API.
    and removed
    bugA problem.
    on Nov 23, 2020
  4. Thomasdezeeuw commented on Nov 23, 2020

    @Thomasdezeeuw
    OwnerAuthor

    Changing to issue to track adding back an implementation of Bytes for &[u8].

  5. added this to the First release milestone on Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions