Skip to content

Commit 08208d4

Browse files
committed
lex_via_rustc: use rustc_driver::catch_fatal_errors rather than catch_unwind
Now ICEs will propagate rather than being treated as lexing rejections
1 parent e7b0534 commit 08208d4

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/lex_via_rustc.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ pub fn analyse(input: &str, edition: Edition) -> Analysis {
158158
Edition::E2021 => rustc_span::edition::Edition::Edition2021,
159159
};
160160

161-
match std::panic::catch_unwind(|| {
161+
match rustc_driver::catch_fatal_errors(|| {
162162
rustc_span::create_session_globals_then(rustc_edition, || {
163163
run_lexer(input, error_list.clone())
164164
})
@@ -174,8 +174,6 @@ pub fn analyse(input: &str, edition: Edition) -> Analysis {
174174
}
175175
}
176176
Err(_) => {
177-
// Lexing panicked
178-
// I think there's no useful information in the panic.
179177
let mut messages = extract_errors(error_list);
180178
messages.push("reported fatal error (panicked)".into());
181179
Analysis::Rejects(Vec::new(), messages)

0 commit comments

Comments
 (0)