From 184a0d7c1eb110571dc773c44a87206261fcf9ce Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Thu, 29 Apr 2021 20:00:21 +0200 Subject: Add test for #8686 --- crates/hir_ty/src/tests/regression.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs index 9cd9f473d..add12c6db 100644 --- a/crates/hir_ty/src/tests/regression.rs +++ b/crates/hir_ty/src/tests/regression.rs @@ -1012,3 +1012,33 @@ fn lifetime_from_chalk_during_deref() { "#, ) } + +#[test] +fn issue_8686() { + check_infer( + r#" +pub trait Try: FromResidual { + type Output; + type Residual; +} +pub trait FromResidual::Residual> { + fn from_residual(residual: R) -> Self; +} + +struct ControlFlow; +impl Try for ControlFlow { + type Output = C; + type Residual = ControlFlow; +} +impl FromResidual for ControlFlow { + fn from_residual(r: ControlFlow) -> Self { ControlFlow } +} + +fn test() { + ControlFlow::from_residual(ControlFlow::); +} + "#, + expect![[r#" + "#]], + ); +} -- cgit v1.2.3