Rework find_super_trait_path to protect against cycles
This commit is contained in:
@@ -814,13 +814,16 @@ pub trait TypeWalk {
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
self.fold_binders(&mut |ty, binders| match ty {
|
||||
Ty::Bound(idx) if idx as usize >= binders => {
|
||||
assert!(idx as i32 >= -n);
|
||||
Ty::Bound((idx as i32 + n) as u32)
|
||||
}
|
||||
ty => ty,
|
||||
}, 0)
|
||||
self.fold_binders(
|
||||
&mut |ty, binders| match ty {
|
||||
Ty::Bound(idx) if idx as usize >= binders => {
|
||||
assert!(idx as i32 >= -n);
|
||||
Ty::Bound((idx as i32 + n) as u32)
|
||||
}
|
||||
ty => ty,
|
||||
},
|
||||
0,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user