Skip to content

Commit 58e6baf

Browse files
committed
mbe: Mark expansion errors cold_path
1 parent 15c701f commit 58e6baf

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

compiler/rustc_expand/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#![doc(rust_logo)]
55
#![feature(array_windows)]
66
#![feature(associated_type_defaults)]
7+
#![feature(cold_path)]
78
#![feature(if_let_guard)]
89
#![feature(macro_metavar_expr)]
910
#![feature(proc_macro_diagnostic)]

compiler/rustc_expand/src/mbe/macro_rules.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ fn expand_macro<'cx>(
229229
let tts = match transcribe(psess, &named_matches, rhs, rhs_span, transparency, id) {
230230
Ok(tts) => tts,
231231
Err(err) => {
232+
// Pessimize error handling for perf
233+
std::hint::cold_path();
232234
let guar = err.emit();
233235
return DummyResult::any(arm_span, guar);
234236
}

0 commit comments

Comments
 (0)