Skip to content

Commit 1d43b4d

Browse files
committed
Exit before fetching bounds on associated items.
1 parent cca9816 commit 1d43b4d

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

compiler/rustc_typeck/src/collect.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -679,13 +679,12 @@ impl<'tcx> ItemCtxt<'tcx> {
679679
};
680680
let bvars = self.tcx.late_bound_vars(bp.bounded_ty.hir_id);
681681

682-
bp.bounds
683-
.iter()
684-
.filter(|b| match assoc_name {
682+
bp.bounds.iter().filter_map(move |b| bt.map(|bt| (bt, b, bvars))).filter(
683+
|(_, b, _)| match assoc_name {
685684
Some(assoc_name) => self.bound_defines_assoc_item(b, assoc_name),
686685
None => true,
687-
})
688-
.filter_map(move |b| bt.map(|bt| (bt, b, bvars)))
686+
},
687+
)
689688
})
690689
.flat_map(|(bt, b, bvars)| predicates_from_bound(self, bt, b, bvars))
691690
.collect()

src/test/ui/traits/issue-96665.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// check-pass
2+
3+
pub trait Sequence<Item, Subsequence: Sequence<Item, Subsequence>> {}
4+
5+
pub trait NodeWalk<Graph: GraphBase, NodeSubwalk: NodeWalk<Graph, NodeSubwalk>>:
6+
Sequence<Graph::NodeIndex, NodeSubwalk>
7+
{
8+
}
9+
10+
pub trait GraphBase {
11+
type NodeIndex;
12+
}
13+
14+
pub trait WalkableGraph: GraphBase {}
15+
16+
fn main() {}

0 commit comments

Comments
 (0)