From f1afc933530a87bd0cc7b25726c9a7fff3f3e007 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 9 Feb 2019 19:07:35 +0100 Subject: Fix handling of literal patterns Wrap them in a LiteralPat node so they can be distinguished from literal expressions. --- .../ra_hir/src/ty/snapshots/tests__infer_std_crash_3.snap | 13 +++++++++++++ crates/ra_hir/src/ty/tests.rs | 15 +++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_std_crash_3.snap (limited to 'crates/ra_hir/src/ty') diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_std_crash_3.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_std_crash_3.snap new file mode 100644 index 000000000..d15b77e17 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_std_crash_3.snap @@ -0,0 +1,13 @@ +--- +created: "2019-02-09T18:02:37.377591660Z" +creator: insta@0.6.1 +source: crates/ra_hir/src/ty/tests.rs +expression: "&result" +--- +[18; 102) '{ ... } }': () +[24; 100) 'match ... }': () +[42; 88) 'SizeSk...tail }': [unknown] +[76; 80) 'true': [unknown] +[82; 86) 'tail': [unknown] +[92; 94) '{}': () + diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 3139eba0b..e0b5a6471 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -663,6 +663,21 @@ fn test_line_buffer() { ); } +#[test] +fn infer_std_crash_3() { + // taken from rustc + check_inference( + "infer_std_crash_3", + r#" +pub fn compute() { + match _ { + SizeSkeleton::Pointer { non_zero: true, tail } => {} + } +} +"#, + ); +} + fn infer(content: &str) -> String { let (db, _, file_id) = MockDatabase::with_single_file(content); let source_file = db.parse(file_id); -- cgit v1.2.3