From c8b2ec8c20be44ae19d15e90ff812745f029899e Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 12 Apr 2020 12:28:24 +0200 Subject: Add support for bounds on associated types in trait definitions E.g. ``` trait Trait { type Item: SomeOtherTrait; } ``` Note that these don't simply desugar to where clauses; as I understand it, where clauses have to be proved by the *user* of the trait, but these bounds are proved by the *implementor*. (Also, where clauses on associated types are unstable.) --- crates/ra_hir_ty/src/traits.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir_ty/src/traits.rs') diff --git a/crates/ra_hir_ty/src/traits.rs b/crates/ra_hir_ty/src/traits.rs index 43d8d1e80..44fbdb197 100644 --- a/crates/ra_hir_ty/src/traits.rs +++ b/crates/ra_hir_ty/src/traits.rs @@ -194,13 +194,16 @@ fn solve( } remaining > 0 }; - let mut solve = || solver.solve_limited(&context, goal, should_continue); + let mut solve = || { + let solution = solver.solve_limited(&context, goal, should_continue); + log::debug!("solve({:?}) => {:?}", goal, solution); + solution + }; // don't set the TLS for Chalk unless Chalk debugging is active, to make // extra sure we only use it for debugging let solution = if is_chalk_debug() { chalk::tls::set_current_program(db, solve) } else { solve() }; - log::debug!("solve({:?}) => {:?}", goal, solution); solution } -- cgit v1.2.3