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

rustfmt partially eats raw reference operators #4066

Closed
ghost opened this issue Feb 26, 2020 · 2 comments
Closed

rustfmt partially eats raw reference operators #4066

ghost opened this issue Feb 26, 2020 · 2 comments

Comments

@ghost
Copy link

ghost commented Feb 26, 2020

Input:

#![feature(raw_ref_op)]

fn main() {
    let x: i32 = 0;
    let _ = &raw const x as *const u32;

    let mut y: i32 = 0;
    let _ = &raw mut y as *mut u32;
}

Output:

#![feature(raw_ref_op)]

fn main() {
    let x: i32 = 0;
    let _ = &x as *const u32;

    let mut y: i32 = 0;
    let _ = &mut y as *mut u32;
}

The input compiles, while the output doesn't compile giving these errors:

error[E0606]: casting `&i32` as `*const u32` is invalid
error[E0606]: casting `&mut i32` as `*mut u32` is invalid

Using rustfmt 1.4.12-nightly (9f53665 2020-02-10)

@calebcartwright
Copy link
Member

Support for raw reference operator syntax was added in #4046, which has not yet been released.

@topecongiro - I can open a rustfmt v1.x PR with the commits that provide support for some of the newer syntax like this (plus trait const opt out and half open ranges) if you think we'll need to publish another 1.x release

@topecongiro
Copy link
Contributor

Closing as this is fixed on the master branch and 1.4.13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants