aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/traits
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-09-07 16:47:56 +0100
committerGitHub <[email protected]>2019-09-07 16:47:56 +0100
commit4a89a7c9026dc3df4466f7b10c666186830d38f6 (patch)
treefdf832ba772141368f27d733cd718ee9a599a346 /crates/ra_hir/src/ty/traits
parenta73b424e3bcf3e211f87d5a9b175a89231848c6d (diff)
parent8fb3cab76c60fbff5ae6f5984ac07b09b42b742c (diff)
Merge #1786
1786: Various minor trait improvements r=matklad a=flodiebold - lower bounds on trait definition, i.e. super traits - use super traits for associated types - use traits from where clauses and their super traits for method resolution - lower fn-like paths (i.e. `Fn(X, Y) -> Z`) - pass the environment to Chalk in the correct way to make elaboration work, i.e. inferring things like `T: Clone` from `T: Copy`. The clauses need to be wrapped in `FromEnv` clauses for that to work, which I didn't do before. - add some tests for closure inference already Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty/traits')
-rw-r--r--crates/ra_hir/src/ty/traits/chalk.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs
index c201c5e50..8a127efa1 100644
--- a/crates/ra_hir/src/ty/traits/chalk.rs
+++ b/crates/ra_hir/src/ty/traits/chalk.rs
@@ -314,7 +314,8 @@ impl ToChalk for Arc<super::TraitEnvironment> {
314 // for env, we just ignore errors 314 // for env, we just ignore errors
315 continue; 315 continue;
316 } 316 }
317 clauses.push(pred.clone().to_chalk(db).cast()); 317 let program_clause: chalk_ir::ProgramClause = pred.clone().to_chalk(db).cast();
318 clauses.push(program_clause.into_from_env_clause());
318 } 319 }
319 chalk_ir::Environment::new().add_clauses(clauses) 320 chalk_ir::Environment::new().add_clauses(clauses)
320 } 321 }
@@ -636,7 +637,7 @@ pub(crate) fn impl_datum_query(
636 _ => None, 637 _ => None,
637 }) 638 })
638 .filter_map(|t| { 639 .filter_map(|t| {
639 let assoc_ty = trait_.associated_type_by_name(db, t.name(db))?; 640 let assoc_ty = trait_.associated_type_by_name(db, &t.name(db))?;
640 let ty = db.type_for_def(t.into(), crate::Namespace::Types).subst(&bound_vars); 641 let ty = db.type_for_def(t.into(), crate::Namespace::Types).subst(&bound_vars);
641 Some(chalk_rust_ir::AssociatedTyValue { 642 Some(chalk_rust_ir::AssociatedTyValue {
642 impl_id, 643 impl_id,