about summary refs log tree commit diff
path: root/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.diff
diff options
context:
space:
mode:
authorJack O'Connor <oconnor663@gmail.com>2021-08-11 14:38:20 -0400
committerJack O'Connor <oconnor663@gmail.com>2021-08-23 01:00:34 -0400
commit9c44d80c83eb250594ecad05ea5340e0b51af525 (patch)
tree7a133a4ec3ba30f84d6613854fe59b1f496f579c /tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.diff
parent558553272d5f80ca6484ed3de961fe4f1a9d411d (diff)
downloadrust-9c44d80c83eb250594ecad05ea5340e0b51af525.tar.gz
rust-9c44d80c83eb250594ecad05ea5340e0b51af525.zip
add Cell::as_array_of_cells, similar to Cell::as_slice_of_cells
Previously, converting `&mut [T; N]` to `&[Cell<T>; N]` looks like this:

    let array = &mut [1, 2, 3];
    let cells: &[Cell<i32>; 3] = Cell::from_mut(&mut array[..])
        .as_slice_of_cells()
        .try_into()
        .unwrap();

With this new helper method, it looks like this:

    let array = &mut [1, 2, 3];
    let cells: &[Cell<i32>; 3] = Cell::from_mut(array).as_array_of_cells();
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.diff')
0 files changed, 0 insertions, 0 deletions