Remove Handler::cancel
This commit is contained in:
parent
2a3930d43c
commit
998df0d70b
@ -1119,7 +1119,7 @@ pub fn note_type_err(
|
||||
Some((expected, found)) => Some((expected, found)),
|
||||
None => {
|
||||
// Derived error. Cancel the emitter.
|
||||
self.tcx.sess.diagnostic().cancel(diag);
|
||||
diag.cancel();
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
@ -520,10 +520,6 @@ pub fn struct_fatal(&self, msg: &str) -> DiagnosticBuilder<'_> {
|
||||
DiagnosticBuilder::new(self, Level::Fatal, msg)
|
||||
}
|
||||
|
||||
pub fn cancel(&self, err: &mut DiagnosticBuilder<'_>) {
|
||||
err.cancel();
|
||||
}
|
||||
|
||||
fn panic_if_treat_err_as_bug(&self) {
|
||||
if self.treat_err_as_bug() {
|
||||
let s = match (self.err_count(), self.flags.treat_err_as_bug.unwrap_or(0)) {
|
||||
|
@ -309,14 +309,14 @@ fn parse_meta_item_inner(&mut self) -> PResult<'a, ast::NestedMetaItem> {
|
||||
Ok(lit) => {
|
||||
return Ok(ast::NestedMetaItem::Literal(lit))
|
||||
}
|
||||
Err(ref mut err) => self.diagnostic().cancel(err)
|
||||
Err(ref mut err) => err.cancel(),
|
||||
}
|
||||
|
||||
match self.parse_meta_item() {
|
||||
Ok(mi) => {
|
||||
return Ok(ast::NestedMetaItem::MetaItem(mi))
|
||||
}
|
||||
Err(ref mut err) => self.diagnostic().cancel(err)
|
||||
Err(ref mut err) => err.cancel(),
|
||||
}
|
||||
|
||||
let found = self.this_token_to_string();
|
||||
|
@ -197,10 +197,6 @@ pub fn span_err<S: Into<MultiSpan>>(&self, sp: S, m: &str) {
|
||||
self.sess.span_diagnostic.span_bug(sp, m)
|
||||
}
|
||||
|
||||
crate fn cancel(&self, err: &mut DiagnosticBuilder<'_>) {
|
||||
self.sess.span_diagnostic.cancel(err)
|
||||
}
|
||||
|
||||
crate fn diagnostic(&self) -> &'a errors::Handler {
|
||||
&self.sess.span_diagnostic
|
||||
}
|
||||
@ -426,15 +422,13 @@ pub fn maybe_annotate_with_ascription(
|
||||
/// Eats and discards tokens until one of `kets` is encountered. Respects token trees,
|
||||
/// passes through any errors encountered. Used for error recovery.
|
||||
crate fn eat_to_tokens(&mut self, kets: &[&TokenKind]) {
|
||||
let handler = self.diagnostic();
|
||||
|
||||
if let Err(ref mut err) = self.parse_seq_to_before_tokens(
|
||||
kets,
|
||||
SeqSep::none(),
|
||||
TokenExpectType::Expect,
|
||||
|p| Ok(p.parse_token_tree()),
|
||||
) {
|
||||
handler.cancel(err);
|
||||
err.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -770,7 +770,7 @@ macro_rules! parse_lit {
|
||||
ex = ExprKind::Lit(literal);
|
||||
}
|
||||
Err(mut err) => {
|
||||
self.cancel(&mut err);
|
||||
err.cancel();
|
||||
return Err(self.expected_expression_found());
|
||||
}
|
||||
}
|
||||
|
@ -537,7 +537,7 @@ fn fatal_unexpected_non_pat(
|
||||
mut err: DiagnosticBuilder<'a>,
|
||||
expected: Expected,
|
||||
) -> PResult<'a, P<Pat>> {
|
||||
self.cancel(&mut err);
|
||||
err.cancel();
|
||||
|
||||
let expected = expected.unwrap_or("pattern");
|
||||
let msg = format!("expected {}, found {}", expected, self.this_token_descr());
|
||||
|
@ -361,7 +361,7 @@ pub fn parse_block(&mut self) -> PResult<'a, P<Block>> {
|
||||
}
|
||||
Err(mut e) => {
|
||||
self.recover_stmt_(SemiColonMode::Break, BlockMode::Ignore);
|
||||
self.cancel(&mut e);
|
||||
e.cancel();
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user