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.)
This commit is contained in:
Florian Diebold
2020-04-12 12:28:24 +02:00
parent c388130f5f
commit c8b2ec8c20
4 changed files with 113 additions and 11 deletions

View File

@@ -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
}