Skip to content

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

Closed

Description

@alexmaco

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
    }
}

Activity

  1. added
    C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICE
    only-with-optionRequires a non-default option value to reproduce
    on Jan 17, 2017
  2. ahti commented on Mar 8, 2017

    @ahti

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

  3. topecongiro commented on May 26, 2017

    @topecongiro
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEonly-with-optionRequires a non-default option value to reproduce

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions