From c0c3b37255423b3547614d74311c4193c0717b56 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sat, 9 Feb 2019 20:55:51 +0100 Subject: Fix another crash found when analyzing rustc --- .../src/ty/snapshots/tests__infer_std_crash_4.snap | 16 ++++++++++++++++ crates/ra_hir/src/ty/tests.rs | 15 +++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_std_crash_4.snap (limited to 'crates/ra_hir/src/ty') diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_std_crash_4.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_std_crash_4.snap new file mode 100644 index 000000000..fb31883ce --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_std_crash_4.snap @@ -0,0 +1,16 @@ +--- +created: "2019-02-09T19:55:39.712470520Z" +creator: insta@0.6.1 +source: crates/ra_hir/src/ty/tests.rs +expression: "&result" +--- +[25; 110) '{ ... } }': () +[31; 108) 'match ... }': () +[37; 42) '*self': [unknown] +[38; 42) 'self': [unknown] +[53; 95) 'Borrow...), ..}': [unknown] +[74; 77) 'box': [unknown] +[78; 87) 'Primitive': [unknown] +[88; 89) 'p': [unknown] +[99; 101) '{}': () + diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index e0b5a6471..e088df97c 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -678,6 +678,21 @@ pub fn compute() { ); } +#[test] +fn infer_std_crash_4() { + // taken from rustc + check_inference( + "infer_std_crash_4", + r#" +pub fn primitive_type() { + match *self { + BorrowedRef { type_: box Primitive(p), ..} => {}, + } +} +"#, + ); +} + 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