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

Various issues with pub(crate) tuple structs containing comments #5011

Closed
cormacrelf opened this issue Sep 29, 2021 · 1 comment · Fixed by #5015
Closed

Various issues with pub(crate) tuple structs containing comments #5011

cormacrelf opened this issue Sep 29, 2021 · 1 comment · Fixed by #5015

Comments

@cormacrelf
Copy link

cormacrelf commented Sep 29, 2021

These relate specifically to pub(crate) tuple structs. Other vis modifiers are not affected. Only occurs when there is a comment before the first unnamed field.

  • ASlash's comment is deleted
  • AStar gets bonus nonsense
  • BStar is like AStar but on one line
pub(crate) struct ASlash(
    // hello
    i32
);
// output:
// pub(crate) struct ASlash(i32);

pub(crate) struct AStar(
    /* hello */
    i32
);
// output:
// pub(crate) struct AStar(
//     crate) struct AStar(
//     /* hello */
//     i32,
// );

pub(crate) struct BStar(/* hello */ i32);
// output:
// pub(crate) struct BStar(crate) struct BStar(/* hello */ i32);

Tested on rustfmt 1.4.37-stable (c8dfcfe0 2021-09-06)

Similar to #919, but those structs were empty, but these ones have fields.

@calebcartwright
Copy link
Member

Thanks for the report!

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

Successfully merging a pull request may close this issue.

2 participants