diff options
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/ty/traits.rs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/crates/ra_hir/src/ty/traits.rs b/crates/ra_hir/src/ty/traits.rs index 367322ed2..e1193c402 100644 --- a/crates/ra_hir/src/ty/traits.rs +++ b/crates/ra_hir/src/ty/traits.rs | |||
@@ -348,13 +348,13 @@ pub(crate) fn implements( | |||
348 | // relevant for our use cases?) | 348 | // relevant for our use cases?) |
349 | let u_canonical = chalk_ir::UCanonical { canonical, universes: 1 }; | 349 | let u_canonical = chalk_ir::UCanonical { canonical, universes: 1 }; |
350 | let solution = solve(db, krate, &u_canonical); | 350 | let solution = solve(db, krate, &u_canonical); |
351 | solution_from_chalk(db, solution) | 351 | solution.map(|solution| solution_from_chalk(db, solution)) |
352 | } | 352 | } |
353 | 353 | ||
354 | fn solution_from_chalk( | 354 | fn solution_from_chalk( |
355 | db: &impl HirDatabase, | 355 | db: &impl HirDatabase, |
356 | solution: Option<chalk_solve::Solution>, | 356 | solution: chalk_solve::Solution, |
357 | ) -> Option<Solution> { | 357 | ) -> Solution { |
358 | let convert_subst = |subst: chalk_ir::Canonical<chalk_ir::Substitution>| { | 358 | let convert_subst = |subst: chalk_ir::Canonical<chalk_ir::Substitution>| { |
359 | let value = subst | 359 | let value = subst |
360 | .value | 360 | .value |
@@ -372,23 +372,22 @@ fn solution_from_chalk( | |||
372 | SolutionVariables(result) | 372 | SolutionVariables(result) |
373 | }; | 373 | }; |
374 | match solution { | 374 | match solution { |
375 | Some(chalk_solve::Solution::Unique(constr_subst)) => { | 375 | chalk_solve::Solution::Unique(constr_subst) => { |
376 | let subst = chalk_ir::Canonical { | 376 | let subst = chalk_ir::Canonical { |
377 | value: constr_subst.value.subst, | 377 | value: constr_subst.value.subst, |
378 | binders: constr_subst.binders, | 378 | binders: constr_subst.binders, |
379 | }; | 379 | }; |
380 | Some(Solution::Unique(convert_subst(subst))) | 380 | Solution::Unique(convert_subst(subst)) |
381 | } | 381 | } |
382 | Some(chalk_solve::Solution::Ambig(chalk_solve::Guidance::Definite(subst))) => { | 382 | chalk_solve::Solution::Ambig(chalk_solve::Guidance::Definite(subst)) => { |
383 | Some(Solution::Ambig(Guidance::Definite(convert_subst(subst)))) | 383 | Solution::Ambig(Guidance::Definite(convert_subst(subst))) |
384 | } | 384 | } |
385 | Some(chalk_solve::Solution::Ambig(chalk_solve::Guidance::Suggested(subst))) => { | 385 | chalk_solve::Solution::Ambig(chalk_solve::Guidance::Suggested(subst)) => { |
386 | Some(Solution::Ambig(Guidance::Suggested(convert_subst(subst)))) | 386 | Solution::Ambig(Guidance::Suggested(convert_subst(subst))) |
387 | } | 387 | } |
388 | Some(chalk_solve::Solution::Ambig(chalk_solve::Guidance::Unknown)) => { | 388 | chalk_solve::Solution::Ambig(chalk_solve::Guidance::Unknown) => { |
389 | Some(Solution::Ambig(Guidance::Unknown)) | 389 | Solution::Ambig(Guidance::Unknown) |
390 | } | 390 | } |
391 | None => None, | ||
392 | } | 391 | } |
393 | } | 392 | } |
394 | 393 | ||