We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6afe135 commit f3fb727Copy full SHA for f3fb727
compiler/rustc_lint/src/impl_trait_overcaptures.rs
@@ -194,10 +194,15 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for VisitOpaqueTypes<'tcx> {
194
.chain(others)
195
.map(|def_id| self.tcx.item_name(def_id).to_string())
196
.collect();
197
- Some((
198
- format!(" use<{}>", generics.join(", ")),
199
- opaque_span.with_lo(opaque_span.lo() + BytePos(4)).shrink_to_lo(),
200
- ))
+ // Make sure that we're not trying to name any APITs
+ if generics.iter().all(|name| !name.starts_with("impl ")) {
+ Some((
+ format!(" use<{}>", generics.join(", ")),
201
+ opaque_span.with_lo(opaque_span.lo() + BytePos(4)).shrink_to_lo(),
202
+ ))
203
+ } else {
204
+ None
205
+ }
206
} else {
207
None
208
};
0 commit comments