about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRyo Yoshida <low.ryoshida@gmail.com>2022-12-25 23:22:33 +0900
committerRyo Yoshida <low.ryoshida@gmail.com>2022-12-25 23:29:33 +0900
commita1a408367e5c4d8b4a323d5e65d8df4d3d9c44cc (patch)
tree62faa0855ece5e66d268950fb651fc952cea8bc5
parenta639917b6612692a3c76a47c9b747c8bfbfaec0f (diff)
downloadrust-a1a408367e5c4d8b4a323d5e65d8df4d3d9c44cc.tar.gz
rust-a1a408367e5c4d8b4a323d5e65d8df4d3d9c44cc.zip
Add regression test
-rw-r--r--crates/ide/src/syntax_highlighting/tests.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs
index 46cc667fc45..2f870d769c0 100644
--- a/crates/ide/src/syntax_highlighting/tests.rs
+++ b/crates/ide/src/syntax_highlighting/tests.rs
@@ -1028,6 +1028,26 @@ macro_rules! test {}
     let _ = analysis.highlight(HL_CONFIG, file_id).unwrap();
 }
 
+#[test]
+fn highlight_callable_no_crash() {
+    // regression test for #13838.
+    let (analysis, file_id) = fixture::file(
+        r#"
+//- minicore: fn, sized
+impl<A, F: ?Sized> FnOnce<A> for &F
+where
+    F: Fn<A>,
+{
+    type Output = F::Output;
+}
+
+trait Trait {}
+fn foo(x: &fn(&dyn Trait)) {}
+"#,
+    );
+    let _ = analysis.highlight(HL_CONFIG, file_id).unwrap();
+}
+
 /// Highlights the code given by the `ra_fixture` argument, renders the
 /// result as HTML, and compares it with the HTML file given as `snapshot`.
 /// Note that the `snapshot` file is overwritten by the rendered HTML.