-
Notifications
You must be signed in to change notification settings - Fork 896
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 removes comment between doc comment and generic params #5320
Comments
#5215 is somewhat related. It mostly deals with not properly adding a newline between comments and struct fields when there is a doc comment preceding the item instead of dropping the comment altogether, but I imagine the we'll need to take a similar approach when recovering the comments to prevent the issue described in #5215. |
Thanks for capturing this so we don't lose track! |
Just a happy coincidence that I came across this as I was making changes to #5305, and peeking into various issues / PRs to see if I could reword any of the CHANGELOG entries. |
Related bug (inline block comment): in pub struct Foo;
impl /*core*/std::error::Error for Foo {} out pub struct Foo;
impl std::error::Error for Foo {} |
add [this link](rust-lang/rustfmt#5320 (comment)) in a comment
@Rudxain thanks for reaching out! There are several places where rustfmt isn't expected to find comments and doesn't try to recover them when reformatting your code. Between the Feel free to open up a separate issue to cover the case you're running into. |
Oh. I didn't expect that 😅
I'll probably do that. I commented BTW, thanks for the info! |
This was an issue discovered when implementing a fix for #5122 in PR #5124 (comment). The issue is reproducible on
rustfmt 1.4.38-nightly (8572b343 2022-04-24)
and uses therustfmt.toml
defined in the rustfmt repo.This input:
Gets formatted as follows:
The text was updated successfully, but these errors were encountered: