Skip to content

pub_restricted formatting breaks code with "Block" fn args #1278

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

Closed
alexmaco opened this issue Jan 17, 2017 · 2 comments
Closed

pub_restricted formatting breaks code with "Block" fn args #1278

alexmaco opened this issue Jan 17, 2017 · 2 comments
Labels
bug Panic, non-idempotency, invalid code, etc. only-with-option requires a non-default option value to reproduce

Comments

@alexmaco
Copy link

rustfmt generates invalid code after formatting code that uses the pub_restricted feature.
The breakage is new in the 0.7 release; in the 0.6.3 release the same erroneous line would be inserted, but it was commented out

input:

#![feature(pub_restricted)]

mod inner_mod {
    pub(super) fn func_name(
        abc: i32
    ) -> i32 {
        abc
    }
}

rustfmt.toml:

fn_args_layout = "Block"

incorrect 0.7 output:

#![feature(pub_restricted)]

mod inner_mod {
    pub(super) fn func_name(
        super) fn func_name(
        abc: i32
    ) -> i32 {
        abc
    }
}

incorrect 0.6.3 output:

#![feature(pub_restricted)]

mod inner_mod {
    pub(super) fn func_name(
        // super) fn func_name(
        abc: i32
    ) -> i32 {
        abc
    }
}
@nrc nrc added bug Panic, non-idempotency, invalid code, etc. only-with-option requires a non-default option value to reproduce labels Jan 17, 2017
@ahti
Copy link

ahti commented Mar 8, 2017

This also happens without fn_args_layout = "Block", using the same example code.

@topecongiro
Copy link
Contributor

Closing since this is fixed on the current master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Panic, non-idempotency, invalid code, etc. only-with-option requires a non-default option value to reproduce
Projects
None yet
Development

No branches or pull requests

4 participants