From af50e8d955caa0b689f3e5b02f0d8ff0302fd3e3 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sun, 21 Mar 2021 18:18:25 +0100 Subject: Fix box pattern inference panic --- crates/hir_ty/src/tests/patterns.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'crates/hir_ty/src/tests/patterns.rs') diff --git a/crates/hir_ty/src/tests/patterns.rs b/crates/hir_ty/src/tests/patterns.rs index 5da19ba5f..85a28e76b 100644 --- a/crates/hir_ty/src/tests/patterns.rs +++ b/crates/hir_ty/src/tests/patterns.rs @@ -656,6 +656,28 @@ fn slice_tail_pattern() { #[test] fn box_pattern() { + check_infer( + r#" + pub struct Global; + #[lang = "owned_box"] + pub struct Box(T); + + fn foo(params: Box) { + match params { + box integer => {} + } + } + "#, + expect![[r#" + 83..89 'params': Box + 101..155 '{ ... } }': () + 107..153 'match ... }': () + 113..119 'params': Box + 130..141 'box integer': Box + 134..141 'integer': i32 + 145..147 '{}': () + "#]], + ); check_infer( r#" #[lang = "owned_box"] -- cgit v1.2.3