track caller on bug_unimplemented

This commit is contained in:
2026-05-16 22:43:44 +02:00
parent 13480b2c54
commit 0bd8bc2f03
+9 -1
View File
@@ -48,11 +48,19 @@ impl<'a, F> AstError<'a, F> {
} }
} }
#[track_caller]
pub fn bug_unimplemented<T>(pair: Pair<'a, Rule>) -> AstResult<'a, T, F> { pub fn bug_unimplemented<T>(pair: Pair<'a, Rule>) -> AstResult<'a, T, F> {
let loc = std::panic::Location::caller();
Err(Self { Err(Self {
span: pair.as_span(), span: pair.as_span(),
error_code: ErrorCode::AstGenBug, error_code: ErrorCode::AstGenBug,
error_message: format!("Possible bug, unimplemented: {:#?}", pair.as_rule()), error_message: format!(
"Possible bug, unimplemented: {:#?}, at {}:{}",
pair.as_rule(),
loc.file(),
loc.line(),
),
recovered: None, recovered: None,
}) })
} }