mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
fix: Fix impl Trait<Self>
causing stackoverflows
This commit is contained in:
parent
2cbc2841d8
commit
1915980031
11 changed files with 233 additions and 149 deletions
|
@ -4711,10 +4711,12 @@ impl Type {
|
|||
if let WhereClause::Implemented(trait_ref) = pred.skip_binders() {
|
||||
cb(type_.clone());
|
||||
// skip the self type. it's likely the type we just got the bounds from
|
||||
for ty in
|
||||
trait_ref.substitution.iter(Interner).skip(1).filter_map(|a| a.ty(Interner))
|
||||
{
|
||||
walk_type(db, &type_.derived(ty.clone()), cb);
|
||||
if let [self_ty, params @ ..] = trait_ref.substitution.as_slice(Interner) {
|
||||
for ty in
|
||||
params.iter().filter(|&ty| ty != self_ty).filter_map(|a| a.ty(Interner))
|
||||
{
|
||||
walk_type(db, &type_.derived(ty.clone()), cb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue