summaryrefslogtreecommitdiffstats
path: root/src/librustc_parse/parser/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/librustc_parse/parser/diagnostics.rs')
-rw-r--r--src/librustc_parse/parser/diagnostics.rs25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/librustc_parse/parser/diagnostics.rs b/src/librustc_parse/parser/diagnostics.rs
index da8bf89..ba125ca 100644
--- a/src/librustc_parse/parser/diagnostics.rs
+++ b/src/librustc_parse/parser/diagnostics.rs
@@ -1,25 +1,22 @@
1use super::{BlockMode, PathStyle, SemiColonMode, TokenType, TokenExpectType, SeqSep, Parser}; 1use super::{BlockMode, PathStyle, SemiColonMode, TokenType, TokenExpectType, SeqSep, Parser};
2 2
3use syntax::ast::{ 3use rustc_data_structures::fx::FxHashSet;
4 self, Param, BinOpKind, BindingMode, BlockCheckMode, Expr, ExprKind, Ident, Item, ItemKind, 4use rustc_errors::{self, PResult, Applicability, DiagnosticBuilder, Handler, pluralize};
5 Mutability, Pat, PatKind, PathSegment, QSelf, Ty, TyKind, 5use rustc_error_codes::*;
6}; 6use syntax::ast::{self, Param, BinOpKind, BindingMode, BlockCheckMode, Expr, ExprKind, Ident, Item};
7use syntax::ast::{ItemKind, Mutability, Pat, PatKind, PathSegment, QSelf, Ty, TyKind};
7use syntax::token::{self, TokenKind, token_can_begin_expr}; 8use syntax::token::{self, TokenKind, token_can_begin_expr};
8use syntax::print::pprust; 9use syntax::print::pprust;
9use syntax::ptr::P; 10use syntax::ptr::P;
10use syntax::symbol::{kw, sym};
11use syntax::ThinVec; 11use syntax::ThinVec;
12use syntax::util::parser::AssocOp; 12use syntax::util::parser::AssocOp;
13use syntax::struct_span_err; 13use syntax::struct_span_err;
14 14use syntax_pos::symbol::{kw, sym};
15use errors::{PResult, Applicability, DiagnosticBuilder, pluralize};
16use rustc_data_structures::fx::FxHashSet;
17use syntax_pos::{Span, DUMMY_SP, MultiSpan, SpanSnippetError}; 15use syntax_pos::{Span, DUMMY_SP, MultiSpan, SpanSnippetError};
16
18use log::{debug, trace}; 17use log::{debug, trace};
19use std::mem; 18use std::mem;
20 19
21use rustc_error_codes::*;
22
23const TURBOFISH: &'static str = "use `::<...>` instead of `<...>` to specify type arguments"; 20const TURBOFISH: &'static str = "use `::<...>` instead of `<...>` to specify type arguments";
24 21
25/// Creates a placeholder argument. 22/// Creates a placeholder argument.
@@ -61,10 +58,10 @@ pub enum Error {
61} 58}
62 59
63impl Error { 60impl Error {
64 fn span_err<S: Into<MultiSpan>>( 61 fn span_err(
65 self, 62 self,
66 sp: S, 63 sp: impl Into<MultiSpan>,
67 handler: &errors::Handler, 64 handler: &Handler,
68 ) -> DiagnosticBuilder<'_> { 65 ) -> DiagnosticBuilder<'_> {
69 match self { 66 match self {
70 Error::FileNotFoundForModule { 67 Error::FileNotFoundForModule {
@@ -212,7 +209,7 @@ impl<'a> Parser<'a> {
212 self.sess.span_diagnostic.span_bug(sp, m) 209 self.sess.span_diagnostic.span_bug(sp, m)
213 } 210 }
214 211
215 pub(super) fn diagnostic(&self) -> &'a errors::Handler { 212 pub(super) fn diagnostic(&self) -> &'a Handler {
216 &self.sess.span_diagnostic 213 &self.sess.span_diagnostic
217 } 214 }
218 215