Allow to self reference associated types in where clauses
This commit is contained in:
parent
24dcf6f7a2
commit
2ca4964db5
8 changed files with 205 additions and 64 deletions
|
@ -436,6 +436,16 @@ rustc_queries! {
|
|||
desc { |tcx| "computing the supertraits of `{}`", tcx.def_path_str(key) }
|
||||
}
|
||||
|
||||
/// Maps from the `DefId` of a trait to the list of
|
||||
/// super-predicates. This is a subset of the full list of
|
||||
/// predicates. We store these in a separate map because we must
|
||||
/// evaluate them even during type conversion, often before the
|
||||
/// full predicates are available (note that supertraits have
|
||||
/// additional acyclicity requirements).
|
||||
query super_predicates_that_define_assoc_type(key: (DefId, Option<rustc_span::symbol::Ident>)) -> ty::GenericPredicates<'tcx> {
|
||||
desc { |tcx| "computing the supertraits of `{}`", tcx.def_path_str(key.0) }
|
||||
}
|
||||
|
||||
/// To avoid cycles within the predicates of a single item we compute
|
||||
/// per-type-parameter predicates for resolving `T::AssocTy`.
|
||||
query type_param_predicates(key: (DefId, LocalDefId, rustc_span::symbol::Ident)) -> ty::GenericPredicates<'tcx> {
|
||||
|
|
|
@ -149,6 +149,17 @@ impl Key for (LocalDefId, DefId) {
|
|||
}
|
||||
}
|
||||
|
||||
impl Key for (DefId, Option<Ident>) {
|
||||
type CacheSelector = DefaultCacheSelector;
|
||||
|
||||
fn query_crate(&self) -> CrateNum {
|
||||
self.0.krate
|
||||
}
|
||||
fn default_span(&self, tcx: TyCtxt<'_>) -> Span {
|
||||
tcx.def_span(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Key for (DefId, LocalDefId, Ident) {
|
||||
type CacheSelector = DefaultCacheSelector;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue