Skip to content

Commit

Permalink
Generate trait bounds on associated types
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 8, 2025
1 parent 1368591 commit 6b3e1e5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions impl/src/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ impl<'a> ParamsInScope<'a> {

fn crawl(in_scope: &ParamsInScope, ty: &Type, found: &mut bool) {
if let Type::Path(ty) = ty {
if ty.qself.is_none() {
if let Some(ident) = ty.path.get_ident() {
if in_scope.names.contains(ident) {
*found = true;
}
if let Some(qself) = &ty.qself {
crawl(in_scope, &qself.ty, found);
} else {
let front = ty.path.segments.first().unwrap();
if front.arguments.is_none() && in_scope.names.contains(&front.ident) {
*found = true;
}
}
for segment in &ty.path.segments {
Expand Down

0 comments on commit 6b3e1e5

Please sign in to comment.