diff options
author | Florian Diebold <[email protected]> | 2019-09-22 19:01:12 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-09-22 19:02:32 +0100 |
commit | 18bf278c258f44ed68f67f84993f20f7c27c63d0 (patch) | |
tree | 3c07347cee581c61107950b1ed9daed191027f5b /crates/ra_hir/src/ty.rs | |
parent | 468e1d14c1a4b3d646207ae919082dc17753cd31 (diff) |
Handle associated type shorthand (`T::Item`)
This is only allowed for generic parameters (including `Self` in traits), and
special care needs to be taken to not run into cycles while resolving it,
because we use the where clauses of the generic parameter to find candidates for
the trait containing the associated type, but the where clauses may themselves
contain instances of short-hand associated types.
In some cases this is even fine, e.g. we might have `T: Trait<U::Item>, U:
Iterator`. If there is a cycle, we'll currently panic, which isn't great, but
better than overflowing the stack...
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r-- | crates/ra_hir/src/ty.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index a223e120a..36bfb10ce 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -23,8 +23,8 @@ pub(crate) use autoderef::autoderef; | |||
23 | pub(crate) use infer::{infer_query, InferTy, InferenceResult}; | 23 | pub(crate) use infer::{infer_query, InferTy, InferenceResult}; |
24 | pub use lower::CallableDef; | 24 | pub use lower::CallableDef; |
25 | pub(crate) use lower::{ | 25 | pub(crate) use lower::{ |
26 | callable_item_sig, generic_defaults_query, generic_predicates_query, type_for_def, | 26 | callable_item_sig, generic_defaults_query, generic_predicates_for_param_query, |
27 | type_for_field, TypableDef, | 27 | generic_predicates_query, type_for_def, type_for_field, TypableDef, |
28 | }; | 28 | }; |
29 | pub(crate) use traits::{InEnvironment, Obligation, ProjectionPredicate, TraitEnvironment}; | 29 | pub(crate) use traits::{InEnvironment, Obligation, ProjectionPredicate, TraitEnvironment}; |
30 | 30 | ||