Rename DiagnosticBuilder
as Diag
.
Much better! Note that this involves renaming (and updating the value of) `DIAGNOSTIC_BUILDER` in clippy.
This commit is contained in:
parent
4e1f9bd528
commit
899cb40809
153 changed files with 1136 additions and 1367 deletions
|
@ -3,8 +3,8 @@ use std::borrow::Cow;
|
|||
use rustc_ast::token::Token;
|
||||
use rustc_ast::{Path, Visibility};
|
||||
use rustc_errors::{
|
||||
codes::*, AddToDiagnostic, Applicability, DiagCtxt, DiagnosticBuilder, EmissionGuarantee,
|
||||
IntoDiagnostic, Level, SubdiagnosticMessageOp,
|
||||
codes::*, AddToDiagnostic, Applicability, Diag, DiagCtxt, EmissionGuarantee, IntoDiagnostic,
|
||||
Level, SubdiagnosticMessageOp,
|
||||
};
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_session::errors::ExprParenthesesNeeded;
|
||||
|
@ -1075,10 +1075,10 @@ pub(crate) struct ExpectedIdentifier {
|
|||
|
||||
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for ExpectedIdentifier {
|
||||
#[track_caller]
|
||||
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
|
||||
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
|
||||
let token_descr = TokenDescription::from_token(&self.token);
|
||||
|
||||
let mut diag = DiagnosticBuilder::new(
|
||||
let mut diag = Diag::new(
|
||||
dcx,
|
||||
level,
|
||||
match token_descr {
|
||||
|
@ -1135,10 +1135,10 @@ pub(crate) struct ExpectedSemi {
|
|||
|
||||
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for ExpectedSemi {
|
||||
#[track_caller]
|
||||
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> DiagnosticBuilder<'a, G> {
|
||||
fn into_diagnostic(self, dcx: &'a DiagCtxt, level: Level) -> Diag<'a, G> {
|
||||
let token_descr = TokenDescription::from_token(&self.token);
|
||||
|
||||
let mut diag = DiagnosticBuilder::new(
|
||||
let mut diag = Diag::new(
|
||||
dcx,
|
||||
level,
|
||||
match token_descr {
|
||||
|
@ -1477,7 +1477,7 @@ pub(crate) struct FnTraitMissingParen {
|
|||
impl AddToDiagnostic for FnTraitMissingParen {
|
||||
fn add_to_diagnostic_with<G: EmissionGuarantee, F: SubdiagnosticMessageOp<G>>(
|
||||
self,
|
||||
diag: &mut DiagnosticBuilder<'_, G>,
|
||||
diag: &mut Diag<'_, G>,
|
||||
_: F,
|
||||
) {
|
||||
diag.span_label(self.span, crate::fluent_generated::parse_fn_trait_missing_paren);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use super::UnmatchedDelim;
|
||||
use rustc_ast::token::Delimiter;
|
||||
use rustc_errors::DiagnosticBuilder;
|
||||
use rustc_errors::Diag;
|
||||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::Span;
|
||||
|
||||
|
@ -30,10 +30,7 @@ pub fn same_indentation_level(sm: &SourceMap, open_sp: Span, close_sp: Span) ->
|
|||
|
||||
// When we get a `)` or `]` for `{`, we should emit help message here
|
||||
// it's more friendly compared to report `unmatched error` in later phase
|
||||
pub fn report_missing_open_delim(
|
||||
err: &mut DiagnosticBuilder<'_>,
|
||||
unmatched_delims: &[UnmatchedDelim],
|
||||
) -> bool {
|
||||
pub fn report_missing_open_delim(err: &mut Diag<'_>, unmatched_delims: &[UnmatchedDelim]) -> bool {
|
||||
let mut reported_missing_open = false;
|
||||
for unmatch_brace in unmatched_delims.iter() {
|
||||
if let Some(delim) = unmatch_brace.found_delim
|
||||
|
@ -55,7 +52,7 @@ pub fn report_missing_open_delim(
|
|||
}
|
||||
|
||||
pub fn report_suspicious_mismatch_block(
|
||||
err: &mut DiagnosticBuilder<'_>,
|
||||
err: &mut Diag<'_>,
|
||||
diag_info: &TokenTreeDiagInfo,
|
||||
sm: &SourceMap,
|
||||
delim: Delimiter,
|
||||
|
|
|
@ -7,7 +7,7 @@ use rustc_ast::ast::{self, AttrStyle};
|
|||
use rustc_ast::token::{self, CommentKind, Delimiter, IdentIsRaw, Token, TokenKind};
|
||||
use rustc_ast::tokenstream::TokenStream;
|
||||
use rustc_ast::util::unicode::contains_text_flow_control_chars;
|
||||
use rustc_errors::{codes::*, Applicability, DiagCtxt, DiagnosticBuilder, StashKey};
|
||||
use rustc_errors::{codes::*, Applicability, Diag, DiagCtxt, StashKey};
|
||||
use rustc_lexer::unescape::{self, EscapeError, Mode};
|
||||
use rustc_lexer::{Base, DocStyle, RawStrError};
|
||||
use rustc_lexer::{Cursor, LiteralKind};
|
||||
|
@ -47,7 +47,7 @@ pub(crate) fn parse_token_trees<'sess, 'src>(
|
|||
mut src: &'src str,
|
||||
mut start_pos: BytePos,
|
||||
override_span: Option<Span>,
|
||||
) -> Result<TokenStream, Vec<DiagnosticBuilder<'sess>>> {
|
||||
) -> Result<TokenStream, Vec<Diag<'sess>>> {
|
||||
// Skip `#!`, if present.
|
||||
if let Some(shebang_len) = rustc_lexer::strip_shebang(src) {
|
||||
src = &src[shebang_len..];
|
||||
|
|
|
@ -18,7 +18,7 @@ use rustc_ast::tokenstream::TokenStream;
|
|||
use rustc_ast::{AttrItem, Attribute, MetaItem};
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_errors::{DiagnosticBuilder, FatalError, PResult};
|
||||
use rustc_errors::{Diag, FatalError, PResult};
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::{FileName, SourceFile, Span};
|
||||
|
||||
|
@ -41,8 +41,7 @@ rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
|
|||
// uses a HOF to parse anything, and <source> includes file and
|
||||
// `source_str`.
|
||||
|
||||
/// A variant of 'panictry!' that works on a `Vec<DiagnosticBuilder>` instead of a single
|
||||
/// `DiagnosticBuilder`.
|
||||
/// A variant of 'panictry!' that works on a `Vec<Diag>` instead of a single `Diag`.
|
||||
macro_rules! panictry_buffer {
|
||||
($e:expr) => {{
|
||||
use std::result::Result::{Err, Ok};
|
||||
|
@ -108,7 +107,7 @@ pub fn maybe_new_parser_from_source_str(
|
|||
sess: &ParseSess,
|
||||
name: FileName,
|
||||
source: String,
|
||||
) -> Result<Parser<'_>, Vec<DiagnosticBuilder<'_>>> {
|
||||
) -> Result<Parser<'_>, Vec<Diag<'_>>> {
|
||||
maybe_source_file_to_parser(sess, sess.source_map().new_source_file(name, source))
|
||||
}
|
||||
|
||||
|
@ -132,7 +131,7 @@ pub fn new_parser_from_file<'a>(sess: &'a ParseSess, path: &Path, sp: Option<Spa
|
|||
fn maybe_source_file_to_parser(
|
||||
sess: &ParseSess,
|
||||
source_file: Lrc<SourceFile>,
|
||||
) -> Result<Parser<'_>, Vec<DiagnosticBuilder<'_>>> {
|
||||
) -> Result<Parser<'_>, Vec<Diag<'_>>> {
|
||||
let end_pos = source_file.end_position();
|
||||
let stream = maybe_file_to_stream(sess, source_file, None)?;
|
||||
let mut parser = stream_to_parser(sess, stream, None);
|
||||
|
@ -160,7 +159,7 @@ fn maybe_file_to_stream<'sess>(
|
|||
sess: &'sess ParseSess,
|
||||
source_file: Lrc<SourceFile>,
|
||||
override_span: Option<Span>,
|
||||
) -> Result<TokenStream, Vec<DiagnosticBuilder<'sess>>> {
|
||||
) -> Result<TokenStream, Vec<Diag<'sess>>> {
|
||||
let src = source_file.src.as_ref().unwrap_or_else(|| {
|
||||
sess.dcx.bug(format!(
|
||||
"cannot lex `source_file` without source: {}",
|
||||
|
|
|
@ -8,7 +8,7 @@ use super::{AttrWrapper, Capturing, FnParseMode, ForceCollect, Parser, PathStyle
|
|||
use rustc_ast as ast;
|
||||
use rustc_ast::attr;
|
||||
use rustc_ast::token::{self, Delimiter, Nonterminal};
|
||||
use rustc_errors::{codes::*, DiagnosticBuilder, PResult};
|
||||
use rustc_errors::{codes::*, Diag, PResult};
|
||||
use rustc_span::{sym, BytePos, Span};
|
||||
use thin_vec::ThinVec;
|
||||
use tracing::debug;
|
||||
|
@ -141,7 +141,7 @@ impl<'a> Parser<'a> {
|
|||
|
||||
fn annotate_following_item_if_applicable(
|
||||
&self,
|
||||
err: &mut DiagnosticBuilder<'_>,
|
||||
err: &mut Diag<'_>,
|
||||
span: Span,
|
||||
attr_type: OuterAttributeType,
|
||||
) -> Option<Span> {
|
||||
|
|
|
@ -36,8 +36,8 @@ use rustc_ast::{
|
|||
use rustc_ast_pretty::pprust;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::{
|
||||
pluralize, AddToDiagnostic, Applicability, DiagCtxt, DiagnosticBuilder, ErrorGuaranteed,
|
||||
FatalError, PErr, PResult,
|
||||
pluralize, AddToDiagnostic, Applicability, Diag, DiagCtxt, ErrorGuaranteed, FatalError, PErr,
|
||||
PResult,
|
||||
};
|
||||
use rustc_session::errors::ExprParenthesesNeeded;
|
||||
use rustc_span::source_map::Spanned;
|
||||
|
@ -210,11 +210,11 @@ struct MultiSugg {
|
|||
}
|
||||
|
||||
impl MultiSugg {
|
||||
fn emit(self, err: &mut DiagnosticBuilder<'_>) {
|
||||
fn emit(self, err: &mut Diag<'_>) {
|
||||
err.multipart_suggestion(self.msg, self.patches, self.applicability);
|
||||
}
|
||||
|
||||
fn emit_verbose(self, err: &mut DiagnosticBuilder<'_>) {
|
||||
fn emit_verbose(self, err: &mut Diag<'_>) {
|
||||
err.multipart_suggestion_verbose(self.msg, self.patches, self.applicability);
|
||||
}
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub(super) fn expected_ident_found_err(&mut self) -> DiagnosticBuilder<'a> {
|
||||
pub(super) fn expected_ident_found_err(&mut self) -> Diag<'a> {
|
||||
self.expected_ident_found(false).unwrap_err()
|
||||
}
|
||||
|
||||
|
@ -849,7 +849,7 @@ impl<'a> Parser<'a> {
|
|||
err.emit()
|
||||
}
|
||||
|
||||
fn check_too_many_raw_str_terminators(&mut self, err: &mut DiagnosticBuilder<'_>) -> bool {
|
||||
fn check_too_many_raw_str_terminators(&mut self, err: &mut Diag<'_>) -> bool {
|
||||
let sm = self.sess.source_map();
|
||||
match (&self.prev_token.kind, &self.token.kind) {
|
||||
(
|
||||
|
@ -983,7 +983,7 @@ impl<'a> Parser<'a> {
|
|||
|
||||
pub(super) fn recover_closure_body(
|
||||
&mut self,
|
||||
mut err: DiagnosticBuilder<'a>,
|
||||
mut err: Diag<'a>,
|
||||
before: token::Token,
|
||||
prev: token::Token,
|
||||
token: token::Token,
|
||||
|
@ -1214,7 +1214,7 @@ impl<'a> Parser<'a> {
|
|||
/// encounter a parse error when encountering the first `,`.
|
||||
pub(super) fn check_mistyped_turbofish_with_multiple_type_params(
|
||||
&mut self,
|
||||
mut e: DiagnosticBuilder<'a>,
|
||||
mut e: Diag<'a>,
|
||||
expr: &mut P<Expr>,
|
||||
) -> PResult<'a, ErrorGuaranteed> {
|
||||
if let ExprKind::Binary(binop, _, _) = &expr.kind
|
||||
|
@ -1262,7 +1262,7 @@ impl<'a> Parser<'a> {
|
|||
|
||||
/// Suggest add the missing `let` before the identifier in stmt
|
||||
/// `a: Ty = 1` -> `let a: Ty = 1`
|
||||
pub(super) fn suggest_add_missing_let_for_stmt(&mut self, err: &mut DiagnosticBuilder<'a>) {
|
||||
pub(super) fn suggest_add_missing_let_for_stmt(&mut self, err: &mut Diag<'a>) {
|
||||
if self.token == token::Colon {
|
||||
let prev_span = self.prev_token.span.shrink_to_lo();
|
||||
let snapshot = self.create_snapshot_for_diagnostic();
|
||||
|
@ -1683,7 +1683,7 @@ impl<'a> Parser<'a> {
|
|||
);
|
||||
err.span_label(op_span, format!("not a valid {} operator", kind.fixity));
|
||||
|
||||
let help_base_case = |mut err: DiagnosticBuilder<'_, _>, base| {
|
||||
let help_base_case = |mut err: Diag<'_, _>, base| {
|
||||
err.help(format!("use `{}= 1` instead", kind.op.chr()));
|
||||
err.emit();
|
||||
Ok(base)
|
||||
|
@ -1844,7 +1844,7 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Creates a `DiagnosticBuilder` for an unexpected token `t` and tries to recover if it is a
|
||||
/// Creates a `Diag` for an unexpected token `t` and tries to recover if it is a
|
||||
/// closing delimiter.
|
||||
pub(super) fn unexpected_try_recover(&mut self, t: &TokenKind) -> PResult<'a, Recovered> {
|
||||
let token_str = pprust::token_kind_to_string(t);
|
||||
|
@ -2188,7 +2188,7 @@ impl<'a> Parser<'a> {
|
|||
|
||||
pub(super) fn parameter_without_type(
|
||||
&mut self,
|
||||
err: &mut DiagnosticBuilder<'_>,
|
||||
err: &mut Diag<'_>,
|
||||
pat: P<ast::Pat>,
|
||||
require_name: bool,
|
||||
first_param: bool,
|
||||
|
@ -2345,7 +2345,7 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub(super) fn expected_expression_found(&self) -> DiagnosticBuilder<'a> {
|
||||
pub(super) fn expected_expression_found(&self) -> Diag<'a> {
|
||||
let (span, msg) = match (&self.token.kind, self.subparser_name) {
|
||||
(&token::Eof, Some(origin)) => {
|
||||
let sp = self.prev_token.span.shrink_to_hi();
|
||||
|
@ -2595,11 +2595,7 @@ impl<'a> Parser<'a> {
|
|||
/// When encountering code like `foo::< bar + 3 >` or `foo::< bar - baz >` we suggest
|
||||
/// `foo::<{ bar + 3 }>` and `foo::<{ bar - baz }>`, respectively. We only provide a suggestion
|
||||
/// if we think that the resulting expression would be well formed.
|
||||
pub fn recover_const_arg(
|
||||
&mut self,
|
||||
start: Span,
|
||||
mut err: DiagnosticBuilder<'a>,
|
||||
) -> PResult<'a, GenericArg> {
|
||||
pub fn recover_const_arg(&mut self, start: Span, mut err: Diag<'a>) -> PResult<'a, GenericArg> {
|
||||
let is_op_or_dot = AssocOp::from_token(&self.token)
|
||||
.and_then(|op| {
|
||||
if let AssocOp::Greater
|
||||
|
@ -2700,11 +2696,7 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
|
||||
/// 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>,
|
||||
span: Span,
|
||||
) -> GenericArg {
|
||||
pub fn dummy_const_arg_needs_braces(&self, mut err: Diag<'a>, span: Span) -> GenericArg {
|
||||
err.multipart_suggestion(
|
||||
"expressions must be enclosed in braces to be used as const generic \
|
||||
arguments",
|
||||
|
|
|
@ -26,7 +26,7 @@ use rustc_ast::{Arm, BlockCheckMode, Expr, ExprKind, Label, Movability, RangeLim
|
|||
use rustc_ast::{ClosureBinder, MetaItemLit, StmtKind};
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
use rustc_errors::{AddToDiagnostic, Applicability, DiagnosticBuilder, PResult, StashKey};
|
||||
use rustc_errors::{AddToDiagnostic, Applicability, Diag, PResult, StashKey};
|
||||
use rustc_lexer::unescape::unescape_char;
|
||||
use rustc_macros::Subdiagnostic;
|
||||
use rustc_session::errors::{report_lit_error, ExprParenthesesNeeded};
|
||||
|
@ -866,7 +866,7 @@ impl<'a> Parser<'a> {
|
|||
);
|
||||
let mut err = self.dcx().struct_span_err(span, msg);
|
||||
|
||||
let suggest_parens = |err: &mut DiagnosticBuilder<'_>| {
|
||||
let suggest_parens = |err: &mut Diag<'_>| {
|
||||
let suggestions = vec![
|
||||
(span.shrink_to_lo(), "(".to_string()),
|
||||
(span.shrink_to_hi(), ")".to_string()),
|
||||
|
@ -1759,7 +1759,7 @@ impl<'a> Parser<'a> {
|
|||
&self,
|
||||
ident: Ident,
|
||||
mk_lit_char: impl FnOnce(Symbol, Span) -> L,
|
||||
err: impl FnOnce(&Self) -> DiagnosticBuilder<'a>,
|
||||
err: impl FnOnce(&Self) -> Diag<'a>,
|
||||
) -> L {
|
||||
assert!(could_be_unclosed_char_literal(ident));
|
||||
if let Some(diag) = self.dcx().steal_diagnostic(ident.span, StashKey::LifetimeIsChar) {
|
||||
|
@ -3447,7 +3447,7 @@ impl<'a> Parser<'a> {
|
|||
let mut recovered_async = None;
|
||||
let in_if_guard = self.restrictions.contains(Restrictions::IN_IF_GUARD);
|
||||
|
||||
let async_block_err = |e: &mut DiagnosticBuilder<'_>, span: Span| {
|
||||
let async_block_err = |e: &mut Diag<'_>, span: Span| {
|
||||
errors::AsyncBlockIn2015 { span }.add_to_diagnostic(e);
|
||||
errors::HelpUseLatestEdition::new().add_to_diagnostic(e);
|
||||
};
|
||||
|
|
|
@ -33,7 +33,7 @@ use rustc_ast::{HasAttrs, HasTokens, Unsafe, Visibility, VisibilityKind};
|
|||
use rustc_ast_pretty::pprust;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::PResult;
|
||||
use rustc_errors::{Applicability, DiagnosticBuilder, FatalError, MultiSpan};
|
||||
use rustc_errors::{Applicability, Diag, FatalError, MultiSpan};
|
||||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
@ -934,7 +934,7 @@ impl<'a> Parser<'a> {
|
|||
fn recover_missing_braces_around_closure_body(
|
||||
&mut self,
|
||||
closure_spans: ClosureSpans,
|
||||
mut expect_err: DiagnosticBuilder<'_>,
|
||||
mut expect_err: Diag<'_>,
|
||||
) -> PResult<'a, ()> {
|
||||
let initial_semicolon = self.token.span;
|
||||
|
||||
|
@ -1522,7 +1522,7 @@ impl<'a> Parser<'a> {
|
|||
pub(crate) fn make_unclosed_delims_error(
|
||||
unmatched: UnmatchedDelim,
|
||||
sess: &ParseSess,
|
||||
) -> Option<DiagnosticBuilder<'_>> {
|
||||
) -> Option<Diag<'_>> {
|
||||
// `None` here means an `Eof` was found. We already emit those errors elsewhere, we add them to
|
||||
// `unmatched_delims` only for error recovery in the `Parser`.
|
||||
let found_delim = unmatched.found_delim?;
|
||||
|
|
|
@ -20,7 +20,7 @@ use rustc_ast::{
|
|||
PatField, PatFieldsRest, PatKind, Path, QSelf, RangeEnd, RangeSyntax,
|
||||
};
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_errors::{Applicability, DiagnosticBuilder, PResult};
|
||||
use rustc_errors::{Applicability, Diag, PResult};
|
||||
use rustc_session::errors::ExprParenthesesNeeded;
|
||||
use rustc_span::source_map::{respan, Spanned};
|
||||
use rustc_span::symbol::{kw, sym, Ident};
|
||||
|
@ -832,7 +832,7 @@ impl<'a> Parser<'a> {
|
|||
|
||||
fn fatal_unexpected_non_pat(
|
||||
&mut self,
|
||||
err: DiagnosticBuilder<'a>,
|
||||
err: Diag<'a>,
|
||||
expected: Option<Expected>,
|
||||
) -> PResult<'a, P<Pat>> {
|
||||
err.cancel();
|
||||
|
@ -1153,7 +1153,7 @@ impl<'a> Parser<'a> {
|
|||
let mut fields = ThinVec::new();
|
||||
let mut etc = PatFieldsRest::None;
|
||||
let mut ate_comma = true;
|
||||
let mut delayed_err: Option<DiagnosticBuilder<'a>> = None;
|
||||
let mut delayed_err: Option<Diag<'a>> = None;
|
||||
let mut first_etc_and_maybe_comma_span = None;
|
||||
let mut last_non_comma_dotdot_span = None;
|
||||
|
||||
|
@ -1316,11 +1316,7 @@ impl<'a> Parser<'a> {
|
|||
|
||||
/// If the user writes `S { ref field: name }` instead of `S { field: ref name }`, we suggest
|
||||
/// the correct code.
|
||||
fn recover_misplaced_pattern_modifiers(
|
||||
&self,
|
||||
fields: &ThinVec<PatField>,
|
||||
err: &mut DiagnosticBuilder<'a>,
|
||||
) {
|
||||
fn recover_misplaced_pattern_modifiers(&self, fields: &ThinVec<PatField>, err: &mut Diag<'a>) {
|
||||
if let Some(last) = fields.iter().last()
|
||||
&& last.is_shorthand
|
||||
&& let PatKind::Ident(binding, ident, None) = last.pat.kind
|
||||
|
|
|
@ -20,7 +20,7 @@ use rustc_ast::util::classify;
|
|||
use rustc_ast::{AttrStyle, AttrVec, LocalKind, MacCall, MacCallStmt, MacStmtStyle};
|
||||
use rustc_ast::{Block, BlockCheckMode, Expr, ExprKind, HasAttrs, Local, Stmt};
|
||||
use rustc_ast::{StmtKind, DUMMY_NODE_ID};
|
||||
use rustc_errors::{Applicability, DiagnosticBuilder, PResult};
|
||||
use rustc_errors::{Applicability, Diag, PResult};
|
||||
use rustc_span::symbol::{kw, sym, Ident};
|
||||
use rustc_span::{BytePos, ErrorGuaranteed, Span};
|
||||
|
||||
|
@ -447,10 +447,7 @@ impl<'a> Parser<'a> {
|
|||
Ok(block)
|
||||
}
|
||||
|
||||
fn error_block_no_opening_brace_msg(
|
||||
&mut self,
|
||||
msg: Cow<'static, str>,
|
||||
) -> DiagnosticBuilder<'a> {
|
||||
fn error_block_no_opening_brace_msg(&mut self, msg: Cow<'static, str>) -> Diag<'a> {
|
||||
let sp = self.token.span;
|
||||
let mut e = self.dcx().struct_span_err(sp, msg);
|
||||
let do_not_suggest_help = self.token.is_keyword(kw::In) || self.token == token::Colon;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue