File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,17 @@ pub struct PathSeg(pub DefId, pub usize);
42
42
pub trait AstConv < ' tcx > {
43
43
fn tcx < ' a > ( & ' a self ) -> TyCtxt < ' tcx > ;
44
44
45
- /// Returns the set of bounds in scope for the type parameter with
46
- /// the given id.
45
+ /// Returns predicates in scope of the form `X: Foo`, where `X` is
46
+ /// a type parameter `X` with the given id `def_id`. This is a
47
+ /// subset of the full set of predicates.
48
+ ///
49
+ /// This is used for one specific purpose: resolving "short-hand"
50
+ /// associated type references like `T::Item`. In principle, we
51
+ /// would do that by first getting the full set of predicates in
52
+ /// scope and then filtering down to find those that apply to `T`,
53
+ /// but this can lead to cycle errors. The problem is that we have
54
+ /// to do this resolution *in order to create the predicates in
55
+ /// the first place*. Hence, we have this "special pass".
47
56
fn get_type_parameter_bounds ( & self , span : Span , def_id : DefId )
48
57
-> & ' tcx ty:: GenericPredicates < ' tcx > ;
49
58
Original file line number Diff line number Diff line change @@ -250,6 +250,8 @@ impl AstConv<'tcx> for ItemCtxt<'tcx> {
250
250
}
251
251
}
252
252
253
+ /// Returns the predicates defined on `item_def_id` of the form
254
+ /// `X: Foo` where `X` is the type parameter `def_id`.
253
255
fn type_param_predicates (
254
256
tcx : TyCtxt < ' _ > ,
255
257
( item_def_id, def_id) : ( DefId , DefId ) ,
You can’t perform that action at this time.
0 commit comments