-
Notifications
You must be signed in to change notification settings - Fork 898
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 deletes comments in first position of trait bound #6051
Comments
I just hit this: diff --git a/tests/rustdoc/rfc-2632-const-trait-impl.rs b/tests/rustdoc/rfc-2632-const-trait-impl.rs
index 6f264969e54..0fec059f951 100644
--- a/tests/rustdoc/rfc-2632-const-trait-impl.rs
+++ b/tests/rustdoc/rfc-2632-const-trait-impl.rs
@@ -24,9 +24,9 @@ pub trait Tr<T> {
// @has - '//section[@id="method.a"]/h4[@class="code-header"]/a[@class="trait"]' 'Fn'
// @!has - '//section[@id="method.a"]/h4[@class="code-header"]/span[@class="where"]' '~const'
// @has - '//section[@id="method.a"]/h4[@class="code-header"]/div[@class="where"]' ': Fn'
- fn a<A: /* ~const */ Fn() + ~const Destruct>()
+ fn a<A: Fn() + ~const Destruct>()
where
- Option<A>: /* ~const */ Fn() + ~const Destruct,
+ Option<A>: Fn() + ~const Destruct,
{
}
} I have a comment removed in both trait bounds: within the generic params, and in the where clause. |
Error: The feature The feature Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #t-infra on Zulip. |
I think hitting the same issue, so not going to raise a new one, but happens for me even in non-first position. Minimal repro passed via -trait RegistrableDevice<DynTrait: ?Sized>: Sized /* + Unsize<DynTrait> */ {}
+trait RegistrableDevice<DynTrait: ?Sized>: Sized {} |
Example code:
Running this through rustfmt deletes the
// Explanatory comment about the bounds
.Workaround: move the
?Sized
into the first position. If your bound is not?Sized
, you can useSized
. The comment is retained:Possibly related to #3669, #4666, #5059 but the examples are in different contexts so I thought I would file a new issue with this test case.
CC @Manishearth
The text was updated successfully, but these errors were encountered: