From e5f9d54661a46c3e37130716264f8c5ea7540af9 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 11 Feb 2019 23:01:52 +0100 Subject: Fix another crash --- .../snapshots/tests__infer_nested_generics_crash.snap | 12 ++++++++++++ crates/ra_hir/src/ty/tests.rs | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 crates/ra_hir/src/ty/snapshots/tests__infer_nested_generics_crash.snap (limited to 'crates/ra_hir/src/ty') diff --git a/crates/ra_hir/src/ty/snapshots/tests__infer_nested_generics_crash.snap b/crates/ra_hir/src/ty/snapshots/tests__infer_nested_generics_crash.snap new file mode 100644 index 000000000..209454a91 --- /dev/null +++ b/crates/ra_hir/src/ty/snapshots/tests__infer_nested_generics_crash.snap @@ -0,0 +1,12 @@ +--- +created: "2019-02-11T21:59:04.302375838Z" +creator: insta@0.6.1 +source: crates/ra_hir/src/ty/tests.rs +expression: "&result" +--- +[92; 106) 'query_response': Canonical> +[137; 167) '{ ...lue; }': () +[143; 164) '&query....value': &QueryResponse +[144; 158) 'query_response': Canonical> +[144; 164) 'query_....value': QueryResponse + diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index e64fd2749..203f1fe4d 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs @@ -719,6 +719,25 @@ fn extra_compiler_flags() { ); } +#[test] +fn infer_nested_generics_crash() { + // another crash found typechecking rustc + check_inference( + "infer_nested_generics_crash", + r#" +struct Canonical { + value: V, +} +struct QueryResponse { + value: V, +} +fn test(query_response: Canonical>) { + &query_response.value; +} +"#, + ); +} + 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