rust/compiler/rustc_mir/src
Dylan DPC fc93e260e9
Rollup merge of #81479 - osa1:issue24151, r=lcnr
Allow casting mut array ref to mut ptr

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-12 22:53:29 +01:00
..
borrow_check Rollup merge of #81479 - osa1:issue24151, r=lcnr 2021-02-12 22:53:29 +01:00
const_eval improve error message for disallowed ptr-to-int casts in const eval 2021-02-05 00:52:19 -08:00
dataflow Remove RCs from Borrows 2021-02-08 20:37:16 +01:00
interpret Auto merge of #81350 - tmiasko:instrument-debug, r=lcnr 2021-02-11 13:44:00 +00:00
monomorphize Rollup merge of #80944 - LingMan:map_or, r=nagisa 2021-01-15 18:26:14 +09:00
transform Auto merge of #81350 - tmiasko:instrument-debug, r=lcnr 2021-02-11 13:44:00 +00:00
util Visit only statements in always live locals 2021-01-27 00:00:00 +00:00
lib.rs Prevent query cycles during inlining 2021-01-23 16:51:22 +00:00
shim.rs Replace let Some(..) = with .is_some() 2021-01-17 19:06:12 -05:00