diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-06 17:28:42 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-06 17:28:42 +0100 |
commit | 9dc9a7a3e2fa858125f9b3c6170c0b259da06fb6 (patch) | |
tree | cce758eabcbcfbb1bc1673601477a9c86580cb2b /crates/ra_hir/src/ty/traits | |
parent | 219e0e8c8d6672feaab2f19b7c3280d5967360e4 (diff) | |
parent | f854a29c9adcfeaa7164928ff91daab9ca9a063c (diff) |
Merge #1496
1496: Add trait obligations for where clauses when calling functions/methods r=matklad a=flodiebold
E.g. if we call `foo<T: Into<u32>>(x)`, that adds an obligation that `x: Into<u32>`, etc., which sometimes allows type inference to make further progress.
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.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs index 2a0537bc3..4c3744b44 100644 --- a/crates/ra_hir/src/ty/traits/chalk.rs +++ b/crates/ra_hir/src/ty/traits/chalk.rs | |||
@@ -428,11 +428,7 @@ pub(crate) fn struct_datum_query( | |||
428 | CallableDef::Struct(s) => s.module(db).krate(db), | 428 | CallableDef::Struct(s) => s.module(db).krate(db), |
429 | CallableDef::EnumVariant(v) => v.parent_enum(db).module(db).krate(db), | 429 | CallableDef::EnumVariant(v) => v.parent_enum(db).module(db).krate(db), |
430 | } != Some(krate); | 430 | } != Some(krate); |
431 | let generic_def: GenericDef = match callable { | 431 | let generic_def: GenericDef = callable.into(); |
432 | CallableDef::Function(f) => f.into(), | ||
433 | CallableDef::Struct(s) => s.into(), | ||
434 | CallableDef::EnumVariant(v) => v.parent_enum(db).into(), | ||
435 | }; | ||
436 | let generic_params = generic_def.generic_params(db); | 432 | let generic_params = generic_def.generic_params(db); |
437 | let bound_vars = Substs::bound_vars(&generic_params); | 433 | let bound_vars = Substs::bound_vars(&generic_params); |
438 | let where_clauses = convert_where_clauses(db, generic_def, &bound_vars); | 434 | let where_clauses = convert_where_clauses(db, generic_def, &bound_vars); |