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

rustfmt mangled C-style inner doc comment #4079

Closed
davepacheco opened this issue Mar 11, 2020 · 0 comments · Fixed by #4080
Closed

rustfmt mangled C-style inner doc comment #4079

davepacheco opened this issue Mar 11, 2020 · 0 comments · Fixed by #4080

Comments

@davepacheco
Copy link

I've got a file with this contents:

/*!
 * * Hello
 *     * Lorem ipsum dolor sit amet, consectetur adipiscing elit. In lacinia
 *       ullamcorper lorem, non hendrerit enim convallis ut. Curabitur id sem
 *
 * Lorem ipsum dolor sit amet, consectetur adipiscing elit. In lacinia
 * ullamcorper lorem, non hendrerit enim convallis ut. Curabitur id sem volutpat
 */

I know that's a little strange, but I've tried to minimize the original test case.

I've got this config file:

$ cat rustfmt.toml 
wrap_comments = true
$ 

When I run rustfmt (nightly, in order use wrap_comments), it wants to add a leading space on the second-to-last line of the comment:

$ rustfmt +nightly --version
rustfmt 1.4.12-nightly (9f53665f 2020-02-10)
$ rustfmt +nightly --check rustfmt-issue.rs 
Diff in /Users/dap/experiments/rust-issue/rustfmt-issue.rs at line 1:
 /*!
  * * Hello
  *     * Lorem ipsum dolor sit amet, consectetur adipiscing elit. In lacinia
- *       ullamcorper lorem, non hendrerit enim convallis ut. Curabitur id sem
+ *       ullamcorper lorem, non hendrerit enim convallis ut. Curabitur id
+ *       sem
  *
  * Lorem ipsum dolor sit amet, consectetur adipiscing elit. In lacinia
- * ullamcorper lorem, non hendrerit enim convallis ut. Curabitur id sem volutpat
+ * ullamcorper lorem, non hendrerit enim convallis ut. Curabitur id sem
+  * volutpat
  */

$ 

The changed line wrapping is surprising, but I'm filing this issue about the extra space added at line 7 (the last line with text in the comment). That's obviously strange, and actually breaks the program because it runs into rust issue 69905. So running rustfmt on this file causes cargo test to fail (although that's only partly rustfmt's fault).

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

Successfully merging a pull request may close this issue.

1 participant