Open sffc opened 10 months ago
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.
Another repro:
@rustbot label +C-bug @rustbot label +p-high
Not sure Rustbot will let me set the p-high label, but I feel I should try. After all this is a case where rustfmt corrupts the code, lossily, in a way that is unlikely to be detected.
Error: The feature relabel
is not enabled in this repository.
To enable it add its section in the triagebot.toml
in the root of the repository.
The feature relabel
is not enabled in this repository.
To enable it add its section in the triagebot.toml
in the root of the repository.
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 rustfmt --check
:
-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 https://github.com/rust-lang/rustfmt/issues/3669, https://github.com/rust-lang/rustfmt/pull/4666, https://github.com/rust-lang/rustfmt/pull/5059 but the examples are in different contexts so I thought I would file a new issue with this test case.
CC @Manishearth