summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock1
-rw-r--r--src/librustc_parse/Cargo.toml9
-rw-r--r--src/librustc_parse/config.rs2
-rw-r--r--src/librustc_parse/lexer/mod.rs11
-rw-r--r--src/librustc_parse/lexer/tokentrees.rs8
-rw-r--r--src/librustc_parse/lexer/unicode_chars.rs4
-rw-r--r--src/librustc_parse/lib.rs4
-rw-r--r--src/librustc_parse/parser/attr.rs2
-rw-r--r--src/librustc_parse/parser/diagnostics.rs25
-rw-r--r--src/librustc_parse/parser/expr.rs17
-rw-r--r--src/librustc_parse/parser/generics.rs2
-rw-r--r--src/librustc_parse/parser/item.rs7
-rw-r--r--src/librustc_parse/parser/mod.rs13
-rw-r--r--src/librustc_parse/parser/module.rs5
-rw-r--r--src/librustc_parse/parser/pat.rs4
-rw-r--r--src/librustc_parse/parser/path.rs4
-rw-r--r--src/librustc_parse/parser/stmt.rs6
-rw-r--r--src/librustc_parse/parser/ty.rs8
-rw-r--r--src/librustc_parse/validate_attr.rs2
19 files changed, 58 insertions, 76 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 5e83513..26727c5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3806,7 +3806,6 @@ dependencies = [
3806 "rustc_errors", 3806 "rustc_errors",
3807 "rustc_feature", 3807 "rustc_feature",
3808 "rustc_lexer", 3808 "rustc_lexer",
3809 "rustc_target",
3810 "smallvec 1.0.0", 3809 "smallvec 1.0.0",
3811 "syntax", 3810 "syntax",
3812 "syntax_pos", 3811 "syntax_pos",
diff --git a/src/librustc_parse/Cargo.toml b/src/librustc_parse/Cargo.toml
index 95b3256..fb5cb74 100644
--- a/src/librustc_parse/Cargo.toml
+++ b/src/librustc_parse/Cargo.toml
@@ -12,12 +12,11 @@ doctest = false
12[dependencies] 12[dependencies]
13bitflags = "1.0" 13bitflags = "1.0"
14log = "0.4" 14log = "0.4"
15syntax_pos = { path = "../libsyntax_pos" }
16syntax = { path = "../libsyntax" }
17errors = { path = "../librustc_errors", package = "rustc_errors" }
18rustc_data_structures = { path = "../librustc_data_structures" } 15rustc_data_structures = { path = "../librustc_data_structures" }
19rustc_feature = { path = "../librustc_feature" } 16rustc_feature = { path = "../librustc_feature" }
20rustc_lexer = { path = "../librustc_lexer" } 17rustc_lexer = { path = "../librustc_lexer" }
21rustc_target = { path = "../librustc_target" } 18rustc_errors = { path = "../librustc_errors" }
22smallvec = { version = "1.0", features = ["union", "may_dangle"] }
23rustc_error_codes = { path = "../librustc_error_codes" } 19rustc_error_codes = { path = "../librustc_error_codes" }
20smallvec = { version = "1.0", features = ["union", "may_dangle"] }
21syntax_pos = { path = "../libsyntax_pos" }
22syntax = { path = "../libsyntax" }
diff --git a/src/librustc_parse/config.rs b/src/librustc_parse/config.rs
index 1bf6e9e..30e056e 100644
--- a/src/librustc_parse/config.rs
+++ b/src/librustc_parse/config.rs
@@ -10,6 +10,7 @@
10 10
11use crate::validate_attr; 11use crate::validate_attr;
12use rustc_feature::Features; 12use rustc_feature::Features;
13use rustc_errors::Applicability;
13use syntax::attr::HasAttrs; 14use syntax::attr::HasAttrs;
14use syntax::feature_gate::{feature_err, get_features}; 15use syntax::feature_gate::{feature_err, get_features};
15use syntax::attr; 16use syntax::attr;
@@ -21,7 +22,6 @@ use syntax::sess::ParseSess;
21use syntax::util::map_in_place::MapInPlace; 22use syntax::util::map_in_place::MapInPlace;
22use syntax_pos::symbol::sym; 23use syntax_pos::symbol::sym;
23 24
24use errors::Applicability;
25use smallvec::SmallVec; 25use smallvec::SmallVec;
26 26
27/// A folder that strips out items that do not belong in the current configuration. 27/// A folder that strips out items that do not belong in the current configuration.
diff --git a/src/librustc_parse/lexer/mod.rs b/src/librustc_parse/lexer/mod.rs
index 5de63cb..ddcfea1 100644
--- a/src/librustc_parse/lexer/mod.rs
+++ b/src/librustc_parse/lexer/mod.rs
@@ -1,16 +1,15 @@
1use rustc_data_structures::sync::Lrc;
2use rustc_errors::{FatalError, DiagnosticBuilder};
3use rustc_lexer::Base;
4use rustc_lexer::unescape;
1use syntax::token::{self, Token, TokenKind}; 5use syntax::token::{self, Token, TokenKind};
2use syntax::sess::ParseSess; 6use syntax::sess::ParseSess;
3use syntax::symbol::{sym, Symbol};
4use syntax::util::comments; 7use syntax::util::comments;
5 8use syntax_pos::symbol::{sym, Symbol};
6use errors::{FatalError, DiagnosticBuilder};
7use syntax_pos::{BytePos, Pos, Span}; 9use syntax_pos::{BytePos, Pos, Span};
8use rustc_lexer::Base;
9use rustc_lexer::unescape;
10 10
11use std::char; 11use std::char;
12use std::convert::TryInto; 12use std::convert::TryInto;
13use rustc_data_structures::sync::Lrc;
14use log::debug; 13use log::debug;
15 14
16mod tokentrees; 15mod tokentrees;
diff --git a/src/librustc_parse/lexer/tokentrees.rs b/src/librustc_parse/lexer/tokentrees.rs
index 1353591..5791c63 100644
--- a/src/librustc_parse/lexer/tokentrees.rs
+++ b/src/librustc_parse/lexer/tokentrees.rs
@@ -1,13 +1,11 @@
1use rustc_data_structures::fx::FxHashMap;
2use syntax_pos::Span;
3
4use super::{StringReader, UnmatchedBrace}; 1use super::{StringReader, UnmatchedBrace};
5 2
3use rustc_data_structures::fx::FxHashMap;
4use rustc_errors::PResult;
6use syntax::print::pprust::token_to_string; 5use syntax::print::pprust::token_to_string;
7use syntax::token::{self, Token}; 6use syntax::token::{self, Token};
8use syntax::tokenstream::{DelimSpan, IsJoint::{self, *}, TokenStream, TokenTree, TreeAndJoint}; 7use syntax::tokenstream::{DelimSpan, IsJoint::{self, *}, TokenStream, TokenTree, TreeAndJoint};
9 8use syntax_pos::Span;
10use errors::PResult;
11 9
12impl<'a> StringReader<'a> { 10impl<'a> StringReader<'a> {
13 crate fn into_token_trees(self) -> (PResult<'a, TokenStream>, Vec<UnmatchedBrace>) { 11 crate fn into_token_trees(self) -> (PResult<'a, TokenStream>, Vec<UnmatchedBrace>) {
diff --git a/src/librustc_parse/lexer/unicode_chars.rs b/src/librustc_parse/lexer/unicode_chars.rs
index 6eb995b6..edfebc7 100644
--- a/src/librustc_parse/lexer/unicode_chars.rs
+++ b/src/librustc_parse/lexer/unicode_chars.rs
@@ -2,9 +2,9 @@
2// http://www.unicode.org/Public/security/10.0.0/confusables.txt 2// http://www.unicode.org/Public/security/10.0.0/confusables.txt
3 3
4use super::StringReader; 4use super::StringReader;
5use errors::{Applicability, DiagnosticBuilder};
6use syntax_pos::{BytePos, Pos, Span, symbol::kw};
7use crate::token; 5use crate::token;
6use rustc_errors::{Applicability, DiagnosticBuilder};
7use syntax_pos::{BytePos, Pos, Span, symbol::kw};
8 8
9#[rustfmt::skip] // for line breaks 9#[rustfmt::skip] // for line breaks
10const UNICODE_ARRAY: &[(char, &str, char)] = &[ 10const UNICODE_ARRAY: &[(char, &str, char)] = &[
diff --git a/src/librustc_parse/lib.rs b/src/librustc_parse/lib.rs
index a22b383..a222f3f 100644
--- a/src/librustc_parse/lib.rs
+++ b/src/librustc_parse/lib.rs
@@ -8,7 +8,7 @@ use syntax::sess::ParseSess;
8use syntax::token::{self, Nonterminal}; 8use syntax::token::{self, Nonterminal};
9use syntax::tokenstream::{self, TokenStream, TokenTree}; 9use syntax::tokenstream::{self, TokenStream, TokenTree};
10 10
11use errors::{PResult, FatalError, Level, Diagnostic}; 11use rustc_errors::{PResult, FatalError, Level, Diagnostic};
12use rustc_data_structures::sync::Lrc; 12use rustc_data_structures::sync::Lrc;
13use syntax_pos::{Span, SourceFile, FileName}; 13use syntax_pos::{Span, SourceFile, FileName};
14 14
@@ -53,7 +53,7 @@ pub enum DirectoryOwnership {
53macro_rules! panictry_buffer { 53macro_rules! panictry_buffer {
54 ($handler:expr, $e:expr) => ({ 54 ($handler:expr, $e:expr) => ({
55 use std::result::Result::{Ok, Err}; 55 use std::result::Result::{Ok, Err};
56 use errors::FatalError; 56 use rustc_errors::FatalError;
57 match $e { 57 match $e {
58 Ok(e) => e, 58 Ok(e) => e,
59 Err(errs) => { 59 Err(errs) => {
diff --git a/src/librustc_parse/parser/attr.rs b/src/librustc_parse/parser/attr.rs
index c726140..b2ae934 100644
--- a/src/librustc_parse/parser/attr.rs
+++ b/src/librustc_parse/parser/attr.rs
@@ -1,10 +1,10 @@
1use super::{SeqSep, Parser, TokenType, PathStyle}; 1use super::{SeqSep, Parser, TokenType, PathStyle};
2use rustc_errors::PResult;
2use syntax::attr; 3use syntax::attr;
3use syntax::ast; 4use syntax::ast;
4use syntax::util::comments; 5use syntax::util::comments;
5use syntax::token::{self, Nonterminal}; 6use syntax::token::{self, Nonterminal};
6use syntax_pos::{Span, Symbol}; 7use syntax_pos::{Span, Symbol};
7use errors::PResult;
8 8
9use log::debug; 9use log::debug;
10 10
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
diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs
index 1112274..3cd4988 100644
--- a/src/librustc_parse/parser/expr.rs
+++ b/src/librustc_parse/parser/expr.rs
@@ -4,23 +4,20 @@ use super::pat::{GateOr, PARAM_EXPECTED};
4use super::diagnostics::Error; 4use super::diagnostics::Error;
5use crate::maybe_recover_from_interpolated_ty_qpath; 5use crate::maybe_recover_from_interpolated_ty_qpath;
6 6
7use syntax::ast::{ 7use rustc_data_structures::thin_vec::ThinVec;
8 self, DUMMY_NODE_ID, Attribute, AttrStyle, Ident, CaptureBy, BlockCheckMode, 8use rustc_errors::{PResult, Applicability};
9 Expr, ExprKind, RangeLimits, Label, Movability, IsAsync, Arm, Ty, TyKind, 9use syntax::ast::{self, DUMMY_NODE_ID, Attribute, AttrStyle, Ident, CaptureBy, BlockCheckMode};
10 FunctionRetTy, Param, FnDecl, BinOpKind, BinOp, UnOp, Mac, AnonConst, Field, Lit, 10use syntax::ast::{Expr, ExprKind, RangeLimits, Label, Movability, IsAsync, Arm, Ty, TyKind};
11}; 11use syntax::ast::{FunctionRetTy, Param, FnDecl, BinOpKind, BinOp, UnOp, Mac, AnonConst, Field, Lit};
12use syntax::token::{self, Token, TokenKind}; 12use syntax::token::{self, Token, TokenKind};
13use syntax::print::pprust; 13use syntax::print::pprust;
14use syntax::ptr::P; 14use syntax::ptr::P;
15use syntax::source_map::{self, Span};
16use syntax::util::classify; 15use syntax::util::classify;
17use syntax::util::literal::LitError; 16use syntax::util::literal::LitError;
18use syntax::util::parser::{AssocOp, Fixity, prec_let_scrutinee_needs_par}; 17use syntax::util::parser::{AssocOp, Fixity, prec_let_scrutinee_needs_par};
19use syntax_pos::symbol::{kw, sym}; 18use syntax_pos::source_map::{self, Span};
20use syntax_pos::Symbol; 19use syntax_pos::symbol::{kw, sym, Symbol};
21use errors::{PResult, Applicability};
22use std::mem; 20use std::mem;
23use rustc_data_structures::thin_vec::ThinVec;
24 21
25/// Possibly accepts an `token::Interpolated` expression (a pre-parsed expression 22/// Possibly accepts an `token::Interpolated` expression (a pre-parsed expression
26/// dropped into the token stream, which happens while parsing the result of 23/// dropped into the token stream, which happens while parsing the result of
diff --git a/src/librustc_parse/parser/generics.rs b/src/librustc_parse/parser/generics.rs
index ba5eafc..32819cc 100644
--- a/src/librustc_parse/parser/generics.rs
+++ b/src/librustc_parse/parser/generics.rs
@@ -1,11 +1,11 @@
1use super::Parser; 1use super::Parser;
2 2
3use rustc_errors::PResult;
3use syntax::ast::{self, WhereClause, GenericParam, GenericParamKind, GenericBounds, Attribute}; 4use syntax::ast::{self, WhereClause, GenericParam, GenericParamKind, GenericBounds, Attribute};
4use syntax::token; 5use syntax::token;
5use syntax::source_map::DUMMY_SP; 6use syntax::source_map::DUMMY_SP;
6use syntax_pos::symbol::{kw, sym}; 7use syntax_pos::symbol::{kw, sym};
7 8
8use errors::PResult;
9 9
10impl<'a> Parser<'a> { 10impl<'a> Parser<'a> {
11 /// Parses bounds of a lifetime parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`. 11 /// Parses bounds of a lifetime parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`.
diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs
index 66a1352..ccf78e6 100644
--- a/src/librustc_parse/parser/item.rs
+++ b/src/librustc_parse/parser/item.rs
@@ -3,6 +3,8 @@ use super::diagnostics::{Error, dummy_arg, ConsumeClosingDelim};
3 3
4use crate::maybe_whole; 4use crate::maybe_whole;
5 5
6use rustc_errors::{PResult, Applicability, DiagnosticBuilder, StashKey};
7use rustc_error_codes::*;
6use syntax::ast::{self, DUMMY_NODE_ID, Ident, Attribute, AttrKind, AttrStyle, AnonConst, Item}; 8use syntax::ast::{self, DUMMY_NODE_ID, Ident, Attribute, AttrKind, AttrStyle, AnonConst, Item};
7use syntax::ast::{ItemKind, ImplItem, ImplItemKind, TraitItem, TraitItemKind, UseTree, UseTreeKind}; 9use syntax::ast::{ItemKind, ImplItem, ImplItemKind, TraitItem, TraitItemKind, UseTree, UseTreeKind};
8use syntax::ast::{PathSegment, IsAuto, Constness, IsAsync, Unsafety, Defaultness, Extern, StrLit}; 10use syntax::ast::{PathSegment, IsAuto, Constness, IsAsync, Unsafety, Defaultness, Extern, StrLit};
@@ -14,16 +16,13 @@ use syntax::ptr::P;
14use syntax::ThinVec; 16use syntax::ThinVec;
15use syntax::token; 17use syntax::token;
16use syntax::tokenstream::{DelimSpan, TokenTree, TokenStream}; 18use syntax::tokenstream::{DelimSpan, TokenTree, TokenStream};
17use syntax::source_map::{self, respan, Span};
18use syntax::struct_span_err; 19use syntax::struct_span_err;
19use syntax_pos::BytePos; 20use syntax_pos::BytePos;
21use syntax_pos::source_map::{self, respan, Span};
20use syntax_pos::symbol::{kw, sym, Symbol}; 22use syntax_pos::symbol::{kw, sym, Symbol};
21 23
22use rustc_error_codes::*;
23
24use log::debug; 24use log::debug;
25use std::mem; 25use std::mem;
26use errors::{PResult, Applicability, DiagnosticBuilder, StashKey};
27 26
28pub(super) type ItemInfo = (Ident, ItemKind, Option<Vec<Attribute>>); 27pub(super) type ItemInfo = (Ident, ItemKind, Option<Vec<Attribute>>);
29 28
diff --git a/src/librustc_parse/parser/mod.rs b/src/librustc_parse/parser/mod.rs
index 2868972..07e99cf 100644
--- a/src/librustc_parse/parser/mod.rs
+++ b/src/librustc_parse/parser/mod.rs
@@ -14,23 +14,20 @@ use diagnostics::Error;
14use crate::{Directory, DirectoryOwnership}; 14use crate::{Directory, DirectoryOwnership};
15use crate::lexer::UnmatchedBrace; 15use crate::lexer::UnmatchedBrace;
16 16
17use syntax::ast::{ 17use rustc_errors::{PResult, Applicability, DiagnosticBuilder, FatalError};
18 self, DUMMY_NODE_ID, AttrStyle, Attribute, CrateSugar, Extern, Ident, StrLit, 18use rustc_data_structures::thin_vec::ThinVec;
19 IsAsync, MacArgs, MacDelimiter, Mutability, Visibility, VisibilityKind, Unsafety, 19use syntax::ast::{self, DUMMY_NODE_ID, AttrStyle, Attribute, CrateSugar, Extern, Ident, StrLit};
20}; 20use syntax::ast::{IsAsync, MacArgs, MacDelimiter, Mutability, Visibility, VisibilityKind, Unsafety};
21
22use syntax::print::pprust; 21use syntax::print::pprust;
23use syntax::ptr::P; 22use syntax::ptr::P;
24use syntax::token::{self, Token, TokenKind, DelimToken}; 23use syntax::token::{self, Token, TokenKind, DelimToken};
25use syntax::tokenstream::{self, DelimSpan, TokenTree, TokenStream, TreeAndJoint}; 24use syntax::tokenstream::{self, DelimSpan, TokenTree, TokenStream, TreeAndJoint};
26use syntax::sess::ParseSess; 25use syntax::sess::ParseSess;
27use syntax::source_map::respan;
28use syntax::struct_span_err; 26use syntax::struct_span_err;
29use syntax::util::comments::{doc_comment_style, strip_doc_comment_decoration}; 27use syntax::util::comments::{doc_comment_style, strip_doc_comment_decoration};
28use syntax_pos::source_map::respan;
30use syntax_pos::symbol::{kw, sym, Symbol}; 29use syntax_pos::symbol::{kw, sym, Symbol};
31use syntax_pos::{Span, BytePos, DUMMY_SP, FileName}; 30use syntax_pos::{Span, BytePos, DUMMY_SP, FileName};
32use rustc_data_structures::thin_vec::ThinVec;
33use errors::{PResult, Applicability, DiagnosticBuilder, FatalError};
34use log::debug; 31use log::debug;
35 32
36use std::borrow::Cow; 33use std::borrow::Cow;
diff --git a/src/librustc_parse/parser/module.rs b/src/librustc_parse/parser/module.rs
index 59d7c2b..5b8526c 100644
--- a/src/librustc_parse/parser/module.rs
+++ b/src/librustc_parse/parser/module.rs
@@ -4,13 +4,12 @@ use super::diagnostics::Error;
4 4
5use crate::{new_sub_parser_from_file, DirectoryOwnership}; 5use crate::{new_sub_parser_from_file, DirectoryOwnership};
6 6
7use rustc_errors::PResult;
7use syntax::attr; 8use syntax::attr;
8use syntax::ast::{self, Ident, Attribute, ItemKind, Mod, Crate}; 9use syntax::ast::{self, Ident, Attribute, ItemKind, Mod, Crate};
9use syntax::token::{self, TokenKind}; 10use syntax::token::{self, TokenKind};
10use syntax::source_map::{SourceMap, Span, DUMMY_SP, FileName}; 11use syntax_pos::source_map::{SourceMap, Span, DUMMY_SP, FileName};
11
12use syntax_pos::symbol::sym; 12use syntax_pos::symbol::sym;
13use errors::PResult;
14 13
15use std::path::{self, Path, PathBuf}; 14use std::path::{self, Path, PathBuf};
16 15
diff --git a/src/librustc_parse/parser/pat.rs b/src/librustc_parse/parser/pat.rs
index 1127c4b..42ece96 100644
--- a/src/librustc_parse/parser/pat.rs
+++ b/src/librustc_parse/parser/pat.rs
@@ -1,5 +1,6 @@
1use super::{Parser, PathStyle}; 1use super::{Parser, PathStyle};
2use crate::{maybe_recover_from_interpolated_ty_qpath, maybe_whole}; 2use crate::{maybe_recover_from_interpolated_ty_qpath, maybe_whole};
3use rustc_errors::{PResult, Applicability, DiagnosticBuilder};
3use syntax::ast::{self, Attribute, Pat, PatKind, FieldPat, RangeEnd, RangeSyntax, Mac}; 4use syntax::ast::{self, Attribute, Pat, PatKind, FieldPat, RangeEnd, RangeSyntax, Mac};
4use syntax::ast::{BindingMode, Ident, Mutability, Path, QSelf, Expr, ExprKind}; 5use syntax::ast::{BindingMode, Ident, Mutability, Path, QSelf, Expr, ExprKind};
5use syntax::mut_visit::{noop_visit_pat, noop_visit_mac, MutVisitor}; 6use syntax::mut_visit::{noop_visit_pat, noop_visit_mac, MutVisitor};
@@ -7,9 +8,8 @@ use syntax::ptr::P;
7use syntax::print::pprust; 8use syntax::print::pprust;
8use syntax::ThinVec; 9use syntax::ThinVec;
9use syntax::token; 10use syntax::token;
10use syntax::source_map::{respan, Span, Spanned}; 11use syntax_pos::source_map::{respan, Span, Spanned};
11use syntax_pos::symbol::{kw, sym}; 12use syntax_pos::symbol::{kw, sym};
12use errors::{PResult, Applicability, DiagnosticBuilder};
13 13
14type Expected = Option<&'static str>; 14type Expected = Option<&'static str>;
15 15
diff --git a/src/librustc_parse/parser/path.rs b/src/librustc_parse/parser/path.rs
index 75bb67d..70c3458 100644
--- a/src/librustc_parse/parser/path.rs
+++ b/src/librustc_parse/parser/path.rs
@@ -1,16 +1,16 @@
1use super::{Parser, TokenType}; 1use super::{Parser, TokenType};
2use crate::maybe_whole; 2use crate::maybe_whole;
3use rustc_errors::{PResult, Applicability, pluralize};
3use syntax::ast::{self, QSelf, Path, PathSegment, Ident, ParenthesizedArgs, AngleBracketedArgs}; 4use syntax::ast::{self, QSelf, Path, PathSegment, Ident, ParenthesizedArgs, AngleBracketedArgs};
4use syntax::ast::{AnonConst, GenericArg, AssocTyConstraint, AssocTyConstraintKind, BlockCheckMode}; 5use syntax::ast::{AnonConst, GenericArg, AssocTyConstraint, AssocTyConstraintKind, BlockCheckMode};
5use syntax::ast::MacArgs; 6use syntax::ast::MacArgs;
6use syntax::ThinVec; 7use syntax::ThinVec;
7use syntax::token::{self, Token}; 8use syntax::token::{self, Token};
8use syntax::source_map::{Span, BytePos}; 9use syntax_pos::source_map::{Span, BytePos};
9use syntax_pos::symbol::{kw, sym}; 10use syntax_pos::symbol::{kw, sym};
10 11
11use std::mem; 12use std::mem;
12use log::debug; 13use log::debug;
13use errors::{PResult, Applicability, pluralize};
14 14
15/// Specifies how to parse a path. 15/// Specifies how to parse a path.
16#[derive(Copy, Clone, PartialEq)] 16#[derive(Copy, Clone, PartialEq)]
diff --git a/src/librustc_parse/parser/stmt.rs b/src/librustc_parse/parser/stmt.rs
index b952e88..943b6ec 100644
--- a/src/librustc_parse/parser/stmt.rs
+++ b/src/librustc_parse/parser/stmt.rs
@@ -6,6 +6,7 @@ use super::diagnostics::Error;
6use crate::maybe_whole; 6use crate::maybe_whole;
7use crate::DirectoryOwnership; 7use crate::DirectoryOwnership;
8 8
9use rustc_errors::{PResult, Applicability};
9use syntax::ThinVec; 10use syntax::ThinVec;
10use syntax::ptr::P; 11use syntax::ptr::P;
11use syntax::ast; 12use syntax::ast;
@@ -13,11 +14,10 @@ use syntax::ast::{DUMMY_NODE_ID, Stmt, StmtKind, Local, Block, BlockCheckMode, E
13use syntax::ast::{Attribute, AttrStyle, VisibilityKind, MacStmtStyle, Mac}; 14use syntax::ast::{Attribute, AttrStyle, VisibilityKind, MacStmtStyle, Mac};
14use syntax::util::classify; 15use syntax::util::classify;
15use syntax::token; 16use syntax::token;
16use syntax::source_map::{respan, Span}; 17use syntax_pos::source_map::{respan, Span};
17use syntax::symbol::{kw, sym}; 18use syntax_pos::symbol::{kw, sym};
18 19
19use std::mem; 20use std::mem;
20use errors::{PResult, Applicability};
21 21
22impl<'a> Parser<'a> { 22impl<'a> Parser<'a> {
23 /// Parses a statement. This stops just before trailing semicolons on everything but items. 23 /// Parses a statement. This stops just before trailing semicolons on everything but items.
diff --git a/src/librustc_parse/parser/ty.rs b/src/librustc_parse/parser/ty.rs
index 3214279..84ffef6 100644
--- a/src/librustc_parse/parser/ty.rs
+++ b/src/librustc_parse/parser/ty.rs
@@ -3,19 +3,17 @@ use super::item::ParamCfg;
3 3
4use crate::{maybe_whole, maybe_recover_from_interpolated_ty_qpath}; 4use crate::{maybe_whole, maybe_recover_from_interpolated_ty_qpath};
5 5
6use rustc_errors::{PResult, Applicability, pluralize};
7use rustc_error_codes::*;
6use syntax::ptr::P; 8use syntax::ptr::P;
7use syntax::ast::{self, Ty, TyKind, MutTy, BareFnTy, FunctionRetTy, GenericParam, Lifetime, Ident}; 9use syntax::ast::{self, Ty, TyKind, MutTy, BareFnTy, FunctionRetTy, GenericParam, Lifetime, Ident};
8use syntax::ast::{TraitBoundModifier, TraitObjectSyntax, GenericBound, GenericBounds, PolyTraitRef}; 10use syntax::ast::{TraitBoundModifier, TraitObjectSyntax, GenericBound, GenericBounds, PolyTraitRef};
9use syntax::ast::{Mutability, AnonConst, Mac}; 11use syntax::ast::{Mutability, AnonConst, Mac};
10use syntax::token::{self, Token}; 12use syntax::token::{self, Token};
11use syntax::source_map::Span;
12use syntax::struct_span_fatal; 13use syntax::struct_span_fatal;
14use syntax_pos::source_map::Span;
13use syntax_pos::symbol::kw; 15use syntax_pos::symbol::kw;
14 16
15use errors::{PResult, Applicability, pluralize};
16
17use rustc_error_codes::*;
18
19/// Returns `true` if `IDENT t` can start a type -- `IDENT::a::b`, `IDENT<u8, u8>`, 17/// Returns `true` if `IDENT t` can start a type -- `IDENT::a::b`, `IDENT<u8, u8>`,
20/// `IDENT<<u8 as Trait>::AssocTy>`. 18/// `IDENT<<u8 as Trait>::AssocTy>`.
21/// 19///
diff --git a/src/librustc_parse/validate_attr.rs b/src/librustc_parse/validate_attr.rs
index 8601add..97e9cb8 100644
--- a/src/librustc_parse/validate_attr.rs
+++ b/src/librustc_parse/validate_attr.rs
@@ -1,6 +1,6 @@
1//! Meta-syntax validation logic of attributes for post-expansion. 1//! Meta-syntax validation logic of attributes for post-expansion.
2 2
3use errors::{PResult, Applicability}; 3use rustc_errors::{PResult, Applicability};
4use rustc_feature::{AttributeTemplate, BUILTIN_ATTRIBUTE_MAP}; 4use rustc_feature::{AttributeTemplate, BUILTIN_ATTRIBUTE_MAP};
5use syntax::ast::{self, Attribute, AttrKind, Ident, MacArgs, MetaItem, MetaItemKind}; 5use syntax::ast::{self, Attribute, AttrKind, Ident, MacArgs, MetaItem, MetaItemKind};
6use syntax::attr::mk_name_value_item_str; 6use syntax::attr::mk_name_value_item_str;