rename ErrorReported -> ErrorGuaranteed

This commit is contained in:
mark
2022-01-23 12:34:26 -06:00
parent c42d846add
commit e489a94dee
112 changed files with 580 additions and 559 deletions
+2 -2
View File
@@ -4,7 +4,7 @@
use rustc_ast::tokenstream::{Spacing, TokenStream};
use rustc_ast::util::unicode::contains_text_flow_control_chars;
use rustc_errors::{
error_code, Applicability, DiagnosticBuilder, ErrorReported, FatalError, PResult,
error_code, Applicability, DiagnosticBuilder, ErrorGuaranteed, FatalError, PResult,
};
use rustc_lexer::unescape::{self, Mode};
use rustc_lexer::{Base, DocStyle, RawStrError};
@@ -129,7 +129,7 @@ fn struct_fatal_span_char(
to_pos: BytePos,
m: &str,
c: char,
) -> DiagnosticBuilder<'a, ErrorReported> {
) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
self.sess
.span_diagnostic
.struct_span_fatal(self.mk_sp(from_pos, to_pos), &format!("{}: {}", m, escaped_char(c)))
+11 -11
View File
@@ -16,7 +16,7 @@
};
use rustc_ast_pretty::pprust;
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::{pluralize, struct_span_err, Diagnostic, ErrorReported};
use rustc_errors::{pluralize, struct_span_err, Diagnostic, ErrorGuaranteed};
use rustc_errors::{Applicability, DiagnosticBuilder, Handler, PResult};
use rustc_span::source_map::Spanned;
use rustc_span::symbol::{kw, Ident};
@@ -57,7 +57,7 @@ fn span_err(
self,
sp: impl Into<MultiSpan>,
handler: &Handler,
) -> DiagnosticBuilder<'_, ErrorReported> {
) -> DiagnosticBuilder<'_, ErrorGuaranteed> {
match self {
Error::UselessDocComment => {
let mut err = struct_span_err!(
@@ -159,7 +159,7 @@ pub(super) fn span_err<S: Into<MultiSpan>>(
&self,
sp: S,
err: Error,
) -> DiagnosticBuilder<'a, ErrorReported> {
) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
err.span_err(sp, self.diagnostic())
}
@@ -167,7 +167,7 @@ pub fn struct_span_err<S: Into<MultiSpan>>(
&self,
sp: S,
m: &str,
) -> DiagnosticBuilder<'a, ErrorReported> {
) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
self.sess.span_diagnostic.struct_span_err(sp, m)
}
@@ -183,7 +183,7 @@ pub(super) fn span_to_snippet(&self, span: Span) -> Result<String, SpanSnippetEr
self.sess.source_map().span_to_snippet(span)
}
pub(super) fn expected_ident_found(&self) -> DiagnosticBuilder<'a, ErrorReported> {
pub(super) fn expected_ident_found(&self) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
let mut err = self.struct_span_err(
self.token.span,
&format!("expected identifier, found {}", super::token_descr(&self.token)),
@@ -729,7 +729,7 @@ pub(super) fn check_turbofish_missing_angle_brackets(&mut self, segment: &mut Pa
/// encounter a parse error when encountering the first `,`.
pub(super) fn check_mistyped_turbofish_with_multiple_type_params(
&mut self,
mut e: DiagnosticBuilder<'a, ErrorReported>,
mut e: DiagnosticBuilder<'a, ErrorGuaranteed>,
expr: &mut P<Expr>,
) -> PResult<'a, ()> {
if let ExprKind::Binary(binop, _, _) = &expr.kind
@@ -1451,7 +1451,7 @@ pub(super) fn recover_seq_parse_error(
pub(super) fn recover_closing_delimiter(
&mut self,
tokens: &[TokenKind],
mut err: DiagnosticBuilder<'a, ErrorReported>,
mut err: DiagnosticBuilder<'a, ErrorGuaranteed>,
) -> PResult<'a, bool> {
let mut pos = None;
// We want to use the last closing delim that would apply.
@@ -1822,7 +1822,7 @@ pub(super) fn consume_block(
}
}
pub(super) fn expected_expression_found(&self) -> DiagnosticBuilder<'a, ErrorReported> {
pub(super) fn expected_expression_found(&self) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
let (span, msg) = match (&self.token.kind, self.subparser_name) {
(&token::Eof, Some(origin)) => {
let sp = self.sess.source_map().next_point(self.prev_token.span);
@@ -2028,7 +2028,7 @@ pub fn recover_const_param_declaration(
pub fn recover_const_arg(
&mut self,
start: Span,
mut err: DiagnosticBuilder<'a, ErrorReported>,
mut err: DiagnosticBuilder<'a, ErrorGuaranteed>,
) -> PResult<'a, GenericArg> {
let is_op_or_dot = AssocOp::from_token(&self.token)
.and_then(|op| {
@@ -2095,7 +2095,7 @@ pub fn recover_const_arg(
/// Creates a dummy const argument, and reports that the expression must be enclosed in braces
pub fn dummy_const_arg_needs_braces(
&self,
mut err: DiagnosticBuilder<'a, ErrorReported>,
mut err: DiagnosticBuilder<'a, ErrorGuaranteed>,
span: Span,
) -> GenericArg {
err.multipart_suggestion(
@@ -2115,7 +2115,7 @@ pub fn dummy_const_arg_needs_braces(
pub(super) fn incorrect_move_async_order_found(
&self,
move_async_span: Span,
) -> DiagnosticBuilder<'a, ErrorReported> {
) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
let mut err =
self.struct_span_err(move_async_span, "the order of `move` and `async` is incorrect");
err.span_suggestion_verbose(
+3 -3
View File
@@ -17,7 +17,7 @@
use rustc_ast::{AnonConst, BinOp, BinOpKind, FnDecl, FnRetTy, MacCall, Param, Ty, TyKind};
use rustc_ast::{Arm, Async, BlockCheckMode, Expr, ExprKind, Label, Movability, RangeLimits};
use rustc_ast_pretty::pprust;
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, ErrorReported, PResult};
use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed, PResult};
use rustc_session::lint::builtin::BREAK_WITH_LABEL_AND_LOOP;
use rustc_session::lint::BuiltinLintDiagnostics;
use rustc_span::edition::LATEST_STABLE_EDITION;
@@ -2126,9 +2126,9 @@ fn parse_if_expr(&mut self, attrs: AttrVec) -> PResult<'a, P<Expr>> {
fn error_missing_if_then_block(
&self,
if_span: Span,
err: Option<DiagnosticBuilder<'a, ErrorReported>>,
err: Option<DiagnosticBuilder<'a, ErrorGuaranteed>>,
binop_span: Option<Span>,
) -> DiagnosticBuilder<'a, ErrorReported> {
) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
let msg = "this `if` expression has a condition, but no block";
let mut err = if let Some(mut err) = err {
+2 -2
View File
@@ -13,7 +13,7 @@
use rustc_ast::{FnHeader, ForeignItem, Path, PathSegment, Visibility, VisibilityKind};
use rustc_ast::{MacArgs, MacCall, MacDelimiter};
use rustc_ast_pretty::pprust;
use rustc_errors::{struct_span_err, Applicability, ErrorReported, PResult, StashKey};
use rustc_errors::{struct_span_err, Applicability, ErrorGuaranteed, PResult, StashKey};
use rustc_span::edition::{Edition, LATEST_STABLE_EDITION};
use rustc_span::lev_distance::lev_distance;
use rustc_span::source_map::{self, Span};
@@ -799,7 +799,7 @@ fn error_ty_alias_where(
before_where_clause_span: Span,
after_predicates: &[WherePredicate],
after_where_clause_span: Span,
) -> ErrorReported {
) -> ErrorGuaranteed {
let mut err =
self.struct_span_err(after_where_clause_span, "where clause not allowed here");
if !after_predicates.is_empty() {
+5 -3
View File
@@ -32,7 +32,9 @@
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sync::Lrc;
use rustc_errors::PResult;
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorReported, FatalError};
use rustc_errors::{
struct_span_err, Applicability, DiagnosticBuilder, ErrorGuaranteed, FatalError,
};
use rustc_session::parse::ParseSess;
use rustc_span::source_map::{MultiSpan, Span, DUMMY_SP};
use rustc_span::symbol::{kw, sym, Ident, Symbol};
@@ -877,7 +879,7 @@ fn parse_seq_to_before_tokens<T>(
fn recover_missing_braces_around_closure_body(
&mut self,
closure_spans: ClosureSpans,
mut expect_err: DiagnosticBuilder<'_, ErrorReported>,
mut expect_err: DiagnosticBuilder<'_, ErrorGuaranteed>,
) -> PResult<'a, ()> {
let initial_semicolon = self.token.span;
@@ -1429,7 +1431,7 @@ pub fn clear_expected_tokens(&mut self) {
crate fn make_unclosed_delims_error(
unmatched: UnmatchedBrace,
sess: &ParseSess,
) -> Option<DiagnosticBuilder<'_, ErrorReported>> {
) -> Option<DiagnosticBuilder<'_, ErrorGuaranteed>> {
// `None` here means an `Eof` was found. We already emit those errors elsewhere, we add them to
// `unmatched_braces` only for error recovery in the `Parser`.
let found_delim = unmatched.found_delim?;
+3 -3
View File
@@ -8,7 +8,7 @@
PatField, PatKind, Path, QSelf, RangeEnd, RangeSyntax,
};
use rustc_ast_pretty::pprust;
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorReported, PResult};
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorGuaranteed, PResult};
use rustc_span::source_map::{respan, Span, Spanned};
use rustc_span::symbol::{kw, sym, Ident};
@@ -678,7 +678,7 @@ fn parse_pat_mac_invoc(&mut self, path: Path) -> PResult<'a, PatKind> {
fn fatal_unexpected_non_pat(
&mut self,
err: DiagnosticBuilder<'a, ErrorReported>,
err: DiagnosticBuilder<'a, ErrorGuaranteed>,
expected: Expected,
) -> PResult<'a, P<Pat>> {
err.cancel();
@@ -914,7 +914,7 @@ fn parse_pat_fields(&mut self) -> PResult<'a, (Vec<PatField>, bool)> {
let mut fields = Vec::new();
let mut etc = false;
let mut ate_comma = true;
let mut delayed_err: Option<DiagnosticBuilder<'a, ErrorReported>> = None;
let mut delayed_err: Option<DiagnosticBuilder<'a, ErrorGuaranteed>> = None;
let mut etc_span = None;
while self.token != token::CloseDelim(token::Brace) {
+2 -2
View File
@@ -18,7 +18,7 @@
};
use rustc_ast::{Block, BlockCheckMode, Expr, ExprKind, Local, Stmt};
use rustc_ast::{StmtKind, DUMMY_NODE_ID};
use rustc_errors::{Applicability, DiagnosticBuilder, ErrorReported, PResult};
use rustc_errors::{Applicability, DiagnosticBuilder, ErrorGuaranteed, PResult};
use rustc_span::source_map::{BytePos, Span};
use rustc_span::symbol::{kw, sym};
@@ -415,7 +415,7 @@ pub(super) fn parse_block(&mut self) -> PResult<'a, P<Block>> {
fn error_block_no_opening_brace_msg(
&mut self,
msg: &str,
) -> DiagnosticBuilder<'a, ErrorReported> {
) -> DiagnosticBuilder<'a, ErrorGuaranteed> {
let sp = self.token.span;
let mut e = self.struct_span_err(sp, msg);
let do_not_suggest_help = self.token.is_keyword(kw::In) || self.token == token::Colon;