mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-12 06:53:05 +00:00
macros: Cancel DiagnosticBuilder when not emitting error
The error handling in libsyntax changed to use a `DiagnosticBuilder` type in the `Err` variant of `PResult`. This type has `emit()` and `cancel()` methods. Once created, errors must be emitted or canceled; if not, the `Drop` impl on `DiagnosticBuilder` will panic. The first syntex_syntax release to include this change was v0.25.0. The bump from v0.23.0 to v0.29.1 in #847 did not add any `cancel()` calls, even though at least one was required. There may be others not caught in this commit.
This commit is contained in:
parent
c59d96a747
commit
a8c27c7086
@ -82,7 +82,10 @@ pub fn rewrite_macro(mac: &ast::Mac,
|
||||
loop {
|
||||
expr_vec.push(match parser.parse_expr() {
|
||||
Ok(expr) => expr,
|
||||
Err(..) => return None,
|
||||
Err(mut e) => {
|
||||
e.cancel();
|
||||
return None;
|
||||
}
|
||||
});
|
||||
|
||||
match parser.token {
|
||||
|
Loading…
Reference in New Issue
Block a user