Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/mir/lower/tests.rs')
-rw-r--r--crates/hir-ty/src/mir/lower/tests.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/crates/hir-ty/src/mir/lower/tests.rs b/crates/hir-ty/src/mir/lower/tests.rs
index 8eb0a02694..fdd67fc4fb 100644
--- a/crates/hir-ty/src/mir/lower/tests.rs
+++ b/crates/hir-ty/src/mir/lower/tests.rs
@@ -150,3 +150,31 @@ fn caller(path: &PathBuf) {
"#,
);
}
+
+#[test]
+fn borrowck_hrtb_closure_argument_does_not_panic() {
+ check_borrowck(
+ r#"
+//- minicore: fn, copy
+enum Res<T, E> {
+ Ok(T),
+ Err(E),
+}
+
+struct S;
+
+impl S {
+ fn set<F>(&mut self, _: F)
+ where
+ F: for<'a> Fn(&mut (), &'a [u8]) -> Res<(), ()>,
+ {
+ }
+}
+
+fn main() {
+ let mut s = S;
+ s.set(|_, _| Res::Err(()));
+}
+ "#,
+ );
+}