6767: Better error when a proc macro panics r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
This commit is contained in:
bors[bot] 2020-12-08 18:47:10 +00:00 committed by GitHub
commit 70fa57f8d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,7 +40,8 @@ impl ProcMacroSrv {
match expander.expand(&task.macro_name, &task.macro_body, task.attributes.as_ref()) { match expander.expand(&task.macro_name, &task.macro_body, task.attributes.as_ref()) {
Ok(expansion) => Ok(ExpansionResult { expansion }), Ok(expansion) => Ok(ExpansionResult { expansion }),
Err(msg) => { Err(msg) => {
Err(format!("Cannot perform expansion for {}: error {:?}", &task.macro_name, msg)) let msg = msg.as_str().unwrap_or("<unknown error>");
Err(format!("proc-macro panicked: {}", msg))
} }
} }
} }