Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow casting mut array ref to mut ptr #81479

Merged
merged 1 commit into from
Feb 13, 2021
Merged

Commits on Feb 10, 2021

  1. 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 rust-lang#24151
    osa1 committed Feb 10, 2021
    Configuration menu
    Copy the full SHA
    d64b749 View commit details
    Browse the repository at this point in the history