Skip to content

map_each_in_place doesn't check or increase alignment #9746

Description

@joseph-isaacs

See

    fn map_each_in_place_keeps_output_alignment_valid() {
        let bytes = BufferMut::<[u8; 4]>::copy_from_aligned([[1u8, 0, 0, 0]], Alignment::new(1));
        assert_eq!(1, Layout::new::<[u8; 4]>().align());
        let words = bytes.map_each_in_place(u32::from_ne_bytes);

        assert_eq!(words.as_slice(), [1]);
        assert!(words.alignment().is_aligned_to(Alignment::of::<u32>()));
    }
``

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions