Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf3fb727

Browse files
Don't suggest using use<> syntax to capture APITs
1 parent6afe135 commitf3fb727

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

‎compiler/rustc_lint/src/impl_trait_overcaptures.rs‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,15 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for VisitOpaqueTypes<'tcx> {
194194
.chain(others)
195195
.map(|def_id|self.tcx.item_name(def_id).to_string())
196196
.collect();
197-
Some((
198-
format!(" use<{}>", generics.join(", ")),
199-
opaque_span.with_lo(opaque_span.lo() +BytePos(4)).shrink_to_lo(),
200-
))
197+
// Make sure that we're not trying to name any APITs
198+
if generics.iter().all(|name| !name.starts_with("impl ")){
199+
Some((
200+
format!(" use<{}>", generics.join(", ")),
201+
opaque_span.with_lo(opaque_span.lo() +BytePos(4)).shrink_to_lo(),
202+
))
203+
}else{
204+
None
205+
}
201206
}else{
202207
None
203208
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp