Skip to content

Commit 184a0d7

Browse files
committed
Add test for #8686
1 parent 80bee14 commit 184a0d7

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

crates/hir_ty/src/tests/regression.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,3 +1012,33 @@ fn lifetime_from_chalk_during_deref() {
10121012
"#,
10131013
)
10141014
}
1015+
1016+
#[test]
1017+
fn issue_8686() {
1018+
check_infer(
1019+
r#"
1020+
pub trait Try: FromResidual {
1021+
type Output;
1022+
type Residual;
1023+
}
1024+
pub trait FromResidual<R = <Self as Try>::Residual> {
1025+
fn from_residual(residual: R) -> Self;
1026+
}
1027+
1028+
struct ControlFlow<B, C>;
1029+
impl<B, C> Try for ControlFlow<B, C> {
1030+
type Output = C;
1031+
type Residual = ControlFlow<B, !>;
1032+
}
1033+
impl<B, C> FromResidual for ControlFlow<B, C> {
1034+
fn from_residual(r: ControlFlow<B, !>) -> Self { ControlFlow }
1035+
}
1036+
1037+
fn test() {
1038+
ControlFlow::from_residual(ControlFlow::<u32, !>);
1039+
}
1040+
"#,
1041+
expect![[r#"
1042+
"#]],
1043+
);
1044+
}

0 commit comments

Comments
 (0)