mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
fix: Don't print proc-macro panic backtraces in the logs
This commit is contained in:
parent
ba01ff4f88
commit
80dc20f7d8
11 changed files with 41 additions and 42 deletions
|
@ -152,6 +152,8 @@ fn line_expand(
|
|||
span: SpanData,
|
||||
) -> ExpandResult<tt::Subtree> {
|
||||
// dummy implementation for type-checking purposes
|
||||
// Note that `line!` and `column!` will never be implemented properly, as they are by definition
|
||||
// not incremental
|
||||
ExpandResult::ok(tt::Subtree {
|
||||
delimiter: tt::Delimiter::dummy_invisible(),
|
||||
token_trees: vec![tt::TokenTree::Leaf(tt::Leaf::Literal(tt::Literal {
|
||||
|
|
|
@ -78,6 +78,7 @@ pub enum ExpandError {
|
|||
Mbe(mbe::ExpandError),
|
||||
RecursionOverflowPoisoned,
|
||||
Other(Box<Box<str>>),
|
||||
ProcMacroPanic(Box<Box<str>>),
|
||||
}
|
||||
|
||||
impl ExpandError {
|
||||
|
@ -100,6 +101,10 @@ impl fmt::Display for ExpandError {
|
|||
ExpandError::RecursionOverflowPoisoned => {
|
||||
f.write_str("overflow expanding the original macro")
|
||||
}
|
||||
ExpandError::ProcMacroPanic(it) => {
|
||||
f.write_str("proc-macro panicked: ")?;
|
||||
f.write_str(it)
|
||||
}
|
||||
ExpandError::Other(it) => f.write_str(it),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ impl ProcMacroExpander {
|
|||
ProcMacroExpansionError::System(text)
|
||||
| ProcMacroExpansionError::Panic(text) => ExpandResult::new(
|
||||
tt::Subtree::empty(tt::DelimSpan { open: call_site, close: call_site }),
|
||||
ExpandError::other(text),
|
||||
ExpandError::ProcMacroPanic(Box::new(text.into_boxed_str())),
|
||||
),
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue