diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs index 9cd9f473d74f..add12c6dbe9f 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#" + "#]], + ); +}