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.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crates/hir-ty/src/mir/lower/tests.rs b/crates/hir-ty/src/mir/lower/tests.rs index d8f7d549d6..cd49549388 100644 --- a/crates/hir-ty/src/mir/lower/tests.rs +++ b/crates/hir-ty/src/mir/lower/tests.rs @@ -134,3 +134,19 @@ fn alias<T: Tr>(x: T::A) { "#, ); } + +#[test] +fn borrowck_opaque_downcast_recovery_does_not_panic() { + check_borrowck( + r#" +//- minicore: option, sized +struct PathBuf; +fn opaque<T>(path: T) -> impl Sized { + Some(path) +} +fn caller(path: &PathBuf) { + let Some(value) = opaque(path) else { return }; +} + "#, + ); +} |