rust/compiler/rustc_mir
Ömer Sinan Ağacan d64b749f2c Allow casting mut array ref to mut ptr
We now allow two new casts:

- mut array reference to mut ptr. Example:

      let mut x: [usize; 2] = [0, 0];
      let p = &mut x as *mut usize;

  We allow casting const array references to const pointers so not
  allowing mut references to mut pointers was inconsistent.

- mut array reference to const ptr. Example:

      let mut x: [usize; 2] = [0, 0];
      let p = &mut x as *const usize;

  This was similarly inconsistent as we allow casting mut references to
  const pointers.

Existing test 'vector-cast-weirdness' updated to test both cases.

Fixes #24151
2021-02-10 15:44:41 +03:00
..
src Allow casting mut array ref to mut ptr 2021-02-10 15:44:41 +03:00
Cargo.toml Auto merge of #78399 - vn-ki:gsgdt-graphviz, r=oli-obk 2020-12-15 22:00:02 +00:00