Skip to content

Commit

Permalink
useful comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nikomatsakis authored and Alexander Regueiro committed Aug 5, 2019
1 parent 709b924 commit 63a67a0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/librustc_typeck/astconv.rs
Expand Up @@ -42,8 +42,17 @@ pub struct PathSeg(pub DefId, pub usize);
pub trait AstConv<'tcx> {
fn tcx<'a>(&'a self) -> TyCtxt<'tcx>;

/// Returns the set of bounds in scope for the type parameter with
/// the given id.
/// Returns predicates in scope of the form `X: Foo`, where `X` is
/// a type parameter `X` with the given id `def_id`. This is a
/// subset of the full set of predicates.
///
/// This is used for one specific purpose: resolving "short-hand"
/// associated type references like `T::Item`. In principle, we
/// would do that by first getting the full set of predicates in
/// scope and then filtering down to find those that apply to `T`,
/// but this can lead to cycle errors. The problem is that we have
/// to do this resolution *in order to create the predicates in
/// the first place*. Hence, we have this "special pass".
fn get_type_parameter_bounds(&self, span: Span, def_id: DefId)
-> &'tcx ty::GenericPredicates<'tcx>;

Expand Down
2 changes: 2 additions & 0 deletions src/librustc_typeck/collect.rs
Expand Up @@ -250,6 +250,8 @@ impl AstConv<'tcx> for ItemCtxt<'tcx> {
}
}

/// Returns the predicates defined on `item_def_id` of the form
/// `X: Foo` where `X` is the type parameter `def_id`.
fn type_param_predicates(
tcx: TyCtxt<'_>,
(item_def_id, def_id): (DefId, DefId),
Expand Down

0 comments on commit 63a67a0

Please sign in to comment.