track caller on bug_unimplemented
This commit is contained in:
+9
-1
@@ -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,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user