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

intrinsics -- as *mut T not always put on the same line in libarena/lib.rs (on Rust repo) #2324

Closed
Kagamihime opened this issue Dec 31, 2017 · 1 comment

Comments

@Kagamihime
Copy link

Kagamihime commented Dec 31, 2017

Hello,

I have tried to submit a PR ( rust-lang/rust#47069 ) on the Rust repo after running rustfmt on the libarena crate but it seems like there are some formatting issues:

  • on lines 136-137 the construct intrinsics -- as *mut T has been split on two lines
  • but on line 367 the construct intrinsics -- as *mut u8 has been put on the same line and there is a comma added after as *mut u8

It seems as if it is not an expected result, so I've decided to submit this issue (my very first issue).

I've used rustfmt-nightly 0.3.4 without options to get this.

@topecongiro
Copy link
Contributor

Reduced example:

Input

fn main() {
    self.ptr.set(intrinsics::arith_offset(self.ptr.get() as *mut u8, 1) as *mut T);
    self.ptr.set(intrinsics::arith_offset(self.ptr.get(), mem::size_of::<T>() as isize) as *mut u8);
}

Output

fn main() {
    self.ptr
        .set(intrinsics::arith_offset(self.ptr.get() as *mut u8, 1)
            as *mut T);
    self.ptr
        .set(intrinsics::arith_offset(self.ptr.get(), mem::size_of::<T>() as isize) as *mut u8);
}

topecongiro added a commit to topecongiro/rustfmt that referenced this issue Jan 10, 2018
@nrc nrc closed this as completed in #2350 Jan 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants