about summary refs log tree commit diff
path: root/src/librustc_parse/parser
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-01-08 12:12:08 +0000
committerbors <bors@rust-lang.org>2020-01-08 12:12:08 +0000
commited6468da160bd67a2ce0573427f09a98daff8c07 (patch)
treef60a0277a129a9835cafbe0eb526b28a4888f0e8 /src/librustc_parse/parser
parent87540bd3bca8dcd86223261f8c76c5bbf6811ee6 (diff)
parent20ebb807d523947f5fac710c4ae95ac9730ad995 (diff)
downloadrust-ed6468da160bd67a2ce0573427f09a98daff8c07.tar.gz
rust-ed6468da160bd67a2ce0573427f09a98daff8c07.zip
Auto merge of #67770 - Centril:reduce-diversity-2, r=petrochenkov
More reductions in error handling diversity

In this follow up to https://github.com/rust-lang/rust/pull/67744, we:

- Remove all fatal / error / warning macros in `syntax` except for `struct_span_err`, which is moved to `rustc_errors`.

- Lintify some hard-coded warnings which used warning macros.

- Defatalize some errors.

In general, the goal here is to make it painful to use fatal or unstructured errors and so we hopefully won't see many of these creep in.

Fixes https://github.com/rust-lang/rust/issues/67933.
Diffstat (limited to 'src/librustc_parse/parser')
-rw-r--r--src/librustc_parse/parser/diagnostics.rs4
-rw-r--r--src/librustc_parse/parser/item.rs3
-rw-r--r--src/librustc_parse/parser/mod.rs3
-rw-r--r--src/librustc_parse/parser/ty.rs3
4 files changed, 5 insertions, 8 deletions
diff --git a/src/librustc_parse/parser/diagnostics.rs b/src/librustc_parse/parser/diagnostics.rs
index 94785e9eff3..9abfbc698c5 100644
--- a/src/librustc_parse/parser/diagnostics.rs
+++ b/src/librustc_parse/parser/diagnostics.rs
@@ -2,7 +2,8 @@ use super::{BlockMode, Parser, PathStyle, SemiColonMode, SeqSep, TokenExpectType
 
 use rustc_data_structures::fx::FxHashSet;
 use rustc_error_codes::*;
-use rustc_errors::{self, pluralize, Applicability, DiagnosticBuilder, Handler, PResult};
+use rustc_errors::{pluralize, struct_span_err};
+use rustc_errors::{Applicability, DiagnosticBuilder, Handler, PResult};
 use rustc_span::symbol::kw;
 use rustc_span::{MultiSpan, Span, SpanSnippetError, DUMMY_SP};
 use syntax::ast::{
@@ -11,7 +12,6 @@ use syntax::ast::{
 use syntax::ast::{AttrVec, ItemKind, Mutability, Pat, PatKind, PathSegment, QSelf, Ty, TyKind};
 use syntax::print::pprust;
 use syntax::ptr::P;
-use syntax::struct_span_err;
 use syntax::token::{self, token_can_begin_expr, TokenKind};
 use syntax::util::parser::AssocOp;
 
diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs
index a05bc48981e..918e826fc26 100644
--- a/src/librustc_parse/parser/item.rs
+++ b/src/librustc_parse/parser/item.rs
@@ -4,7 +4,7 @@ use super::{FollowedByType, Parser, PathStyle};
 use crate::maybe_whole;
 
 use rustc_error_codes::*;
-use rustc_errors::{Applicability, DiagnosticBuilder, PResult, StashKey};
+use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, PResult, StashKey};
 use rustc_span::source_map::{self, respan, Span};
 use rustc_span::symbol::{kw, sym, Symbol};
 use rustc_span::BytePos;
@@ -16,7 +16,6 @@ use syntax::ast::{EnumDef, Generics, StructField, TraitRef, Ty, TyKind, Variant,
 use syntax::ast::{FnHeader, ForeignItem, ForeignItemKind, Mutability, Visibility, VisibilityKind};
 use syntax::print::pprust;
 use syntax::ptr::P;
-use syntax::struct_span_err;
 use syntax::token;
 use syntax::tokenstream::{DelimSpan, TokenStream, TokenTree};
 
diff --git a/src/librustc_parse/parser/mod.rs b/src/librustc_parse/parser/mod.rs
index a2fa335cf72..8d695eda98d 100644
--- a/src/librustc_parse/parser/mod.rs
+++ b/src/librustc_parse/parser/mod.rs
@@ -15,7 +15,7 @@ use crate::lexer::UnmatchedBrace;
 use crate::{Directory, DirectoryOwnership};
 
 use log::debug;
-use rustc_errors::{Applicability, DiagnosticBuilder, FatalError, PResult};
+use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, FatalError, PResult};
 use rustc_span::source_map::respan;
 use rustc_span::symbol::{kw, sym, Symbol};
 use rustc_span::{BytePos, FileName, Span, DUMMY_SP};
@@ -24,7 +24,6 @@ use syntax::ast::{IsAsync, MacArgs, MacDelimiter, Mutability, StrLit, Visibility
 use syntax::print::pprust;
 use syntax::ptr::P;
 use syntax::sess::ParseSess;
-use syntax::struct_span_err;
 use syntax::token::{self, DelimToken, Token, TokenKind};
 use syntax::tokenstream::{self, DelimSpan, TokenStream, TokenTree, TreeAndJoint};
 use syntax::util::comments::{doc_comment_style, strip_doc_comment_decoration};
diff --git a/src/librustc_parse/parser/ty.rs b/src/librustc_parse/parser/ty.rs
index 4122aa17f83..f96c82a1ab3 100644
--- a/src/librustc_parse/parser/ty.rs
+++ b/src/librustc_parse/parser/ty.rs
@@ -4,7 +4,7 @@ use super::{Parser, PathStyle, PrevTokenKind, TokenType};
 use crate::{maybe_recover_from_interpolated_ty_qpath, maybe_whole};
 
 use rustc_error_codes::*;
-use rustc_errors::{pluralize, Applicability, PResult};
+use rustc_errors::{pluralize, struct_span_err, Applicability, PResult};
 use rustc_span::source_map::Span;
 use rustc_span::symbol::kw;
 use syntax::ast::{
@@ -15,7 +15,6 @@ use syntax::ast::{
 };
 use syntax::ast::{Mac, Mutability};
 use syntax::ptr::P;
-use syntax::struct_span_err;
 use syntax::token::{self, Token};
 
 /// Returns `true` if `IDENT t` can start a type -- `IDENT::a::b`, `IDENT<u8, u8>`,