Skip to content

Commit a1a4083

Browse files
committed
Add regression test
1 parent a639917 commit a1a4083

File tree

1 file changed

+20
-0
lines changed
  • crates/ide/src/syntax_highlighting

1 file changed

+20
-0
lines changed

crates/ide/src/syntax_highlighting/tests.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,26 @@ macro_rules! test {}
10281028
let _ = analysis.highlight(HL_CONFIG, file_id).unwrap();
10291029
}
10301030

1031+
#[test]
1032+
fn highlight_callable_no_crash() {
1033+
// regression test for #13838.
1034+
let (analysis, file_id) = fixture::file(
1035+
r#"
1036+
//- minicore: fn, sized
1037+
impl<A, F: ?Sized> FnOnce<A> for &F
1038+
where
1039+
F: Fn<A>,
1040+
{
1041+
type Output = F::Output;
1042+
}
1043+
1044+
trait Trait {}
1045+
fn foo(x: &fn(&dyn Trait)) {}
1046+
"#,
1047+
);
1048+
let _ = analysis.highlight(HL_CONFIG, file_id).unwrap();
1049+
}
1050+
10311051
/// Highlights the code given by the `ra_fixture` argument, renders the
10321052
/// result as HTML, and compares it with the HTML file given as `snapshot`.
10331053
/// Note that the `snapshot` file is overwritten by the rendered HTML.

0 commit comments

Comments
 (0)