diff options
| author | bors <bors@rust-lang.org> | 2024-12-18 02:56:38 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-12-18 02:56:38 +0000 |
| commit | a89ca2c85e61d03c6e41be89508ed3d012f916f8 (patch) | |
| tree | 5101d43e44eb7dae8f58f17ced5b92a9584beb04 /compiler/rustc_parse | |
| parent | 52890e82153cd8716d97a96f47fb6ac99dec65be (diff) | |
| parent | 2620eb42d72d24baa1ca1056a769862b92c85f7f (diff) | |
| download | rust-a89ca2c85e61d03c6e41be89508ed3d012f916f8.tar.gz rust-a89ca2c85e61d03c6e41be89508ed3d012f916f8.zip | |
Auto merge of #134243 - nnethercote:re-export-more-rustc_span, r=jieyouxu
Re-export more `rustc_span::symbol` things from `rustc_span`.
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason.
This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers to `rustc_span::`. This is a 300+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
r? `@jieyouxu`
Diffstat (limited to 'compiler/rustc_parse')
| -rw-r--r-- | compiler/rustc_parse/src/errors.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/lexer/mod.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/lexer/unicode_chars.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/attr.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/diagnostics.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/generics.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/mut_visit/tests.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/nonterminal.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/pat.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/path.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/stmt.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/tests.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/ty.rs | 3 |
16 files changed, 19 insertions, 31 deletions
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 4c4e03cdfa3..f78d9dc2bfc 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -13,8 +13,7 @@ use rustc_errors::{ use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_session::errors::ExprParenthesesNeeded; use rustc_span::edition::{Edition, LATEST_STABLE_EDITION}; -use rustc_span::symbol::Ident; -use rustc_span::{Span, Symbol}; +use rustc_span::{Ident, Span, Symbol}; use crate::fluent_generated as fluent; use crate::parser::{ForbiddenLetReason, TokenDescription}; diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs index 443ddfc94ec..792e2cc26ef 100644 --- a/compiler/rustc_parse/src/lexer/mod.rs +++ b/compiler/rustc_parse/src/lexer/mod.rs @@ -14,8 +14,7 @@ use rustc_session::lint::builtin::{ TEXT_DIRECTION_CODEPOINT_IN_COMMENT, }; use rustc_session::parse::ParseSess; -use rustc_span::symbol::Symbol; -use rustc_span::{BytePos, Pos, Span}; +use rustc_span::{BytePos, Pos, Span, Symbol}; use tracing::debug; use crate::lexer::diagnostics::TokenTreeDiagInfo; diff --git a/compiler/rustc_parse/src/lexer/unicode_chars.rs b/compiler/rustc_parse/src/lexer/unicode_chars.rs index 42eef27803e..ef8d0f96b61 100644 --- a/compiler/rustc_parse/src/lexer/unicode_chars.rs +++ b/compiler/rustc_parse/src/lexer/unicode_chars.rs @@ -1,8 +1,7 @@ //! Characters and their corresponding confusables were collected from //! <https://www.unicode.org/Public/security/10.0.0/confusables.txt> -use rustc_span::symbol::kw; -use rustc_span::{BytePos, Pos, Span}; +use rustc_span::{BytePos, Pos, Span, kw}; use super::Lexer; use crate::errors::TokenSubstitution; diff --git a/compiler/rustc_parse/src/parser/attr.rs b/compiler/rustc_parse/src/parser/attr.rs index 8cf37671185..9da4ab5a788 100644 --- a/compiler/rustc_parse/src/parser/attr.rs +++ b/compiler/rustc_parse/src/parser/attr.rs @@ -2,8 +2,7 @@ use rustc_ast::token::{self, Delimiter}; use rustc_ast::{self as ast, Attribute, attr}; use rustc_errors::codes::*; use rustc_errors::{Diag, PResult}; -use rustc_span::symbol::kw; -use rustc_span::{BytePos, Span}; +use rustc_span::{BytePos, Span, kw}; use thin_vec::ThinVec; use tracing::debug; diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index e5edf605d82..d1a725e729a 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -22,8 +22,8 @@ use rustc_errors::{ use rustc_session::errors::ExprParenthesesNeeded; use rustc_span::edit_distance::find_best_match_for_name; use rustc_span::source_map::Spanned; -use rustc_span::symbol::{AllKeywords, Ident, kw, sym}; -use rustc_span::{BytePos, DUMMY_SP, Span, SpanSnippetError, Symbol}; +use rustc_span::symbol::AllKeywords; +use rustc_span::{BytePos, DUMMY_SP, Ident, Span, SpanSnippetError, Symbol, kw, sym}; use thin_vec::{ThinVec, thin_vec}; use tracing::{debug, trace}; diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index a2136399b0c..5a377464223 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -26,8 +26,7 @@ use rustc_session::errors::{ExprParenthesesNeeded, report_lit_error}; use rustc_session::lint::BuiltinLintDiag; use rustc_session::lint::builtin::BREAK_WITH_LABEL_AND_LOOP; use rustc_span::source_map::{self, Spanned}; -use rustc_span::symbol::{Ident, Symbol, kw, sym}; -use rustc_span::{BytePos, ErrorGuaranteed, Pos, Span}; +use rustc_span::{BytePos, ErrorGuaranteed, Ident, Pos, Span, Symbol, kw, sym}; use thin_vec::{ThinVec, thin_vec}; use tracing::instrument; diff --git a/compiler/rustc_parse/src/parser/generics.rs b/compiler/rustc_parse/src/parser/generics.rs index 76ecb77d750..65e390c9a82 100644 --- a/compiler/rustc_parse/src/parser/generics.rs +++ b/compiler/rustc_parse/src/parser/generics.rs @@ -4,8 +4,7 @@ use rustc_ast::{ WhereClause, token, }; use rustc_errors::{Applicability, PResult}; -use rustc_span::Span; -use rustc_span::symbol::{Ident, kw}; +use rustc_span::{Ident, Span, kw}; use thin_vec::ThinVec; use super::{ForceCollect, Parser, Trailing, UsePreAttrPos}; diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index e27fc963eb9..e6a8eda42e8 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -13,8 +13,7 @@ use rustc_errors::codes::*; use rustc_errors::{Applicability, PResult, StashKey, struct_span_code_err}; use rustc_span::edit_distance::edit_distance; use rustc_span::edition::Edition; -use rustc_span::symbol::{Ident, Symbol, kw, sym}; -use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, source_map}; +use rustc_span::{DUMMY_SP, ErrorGuaranteed, Ident, Span, Symbol, kw, source_map, sym}; use thin_vec::{ThinVec, thin_vec}; use tracing::debug; diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 976ffe608a2..0d220e74c0e 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -39,8 +39,7 @@ use rustc_data_structures::sync::Lrc; use rustc_errors::{Applicability, Diag, FatalError, MultiSpan, PResult}; use rustc_index::interval::IntervalSet; use rustc_session::parse::ParseSess; -use rustc_span::symbol::{Ident, Symbol, kw, sym}; -use rustc_span::{DUMMY_SP, Span}; +use rustc_span::{DUMMY_SP, Ident, Span, Symbol, kw, sym}; use thin_vec::ThinVec; use tracing::debug; diff --git a/compiler/rustc_parse/src/parser/mut_visit/tests.rs b/compiler/rustc_parse/src/parser/mut_visit/tests.rs index b82c295732d..46c678c3902 100644 --- a/compiler/rustc_parse/src/parser/mut_visit/tests.rs +++ b/compiler/rustc_parse/src/parser/mut_visit/tests.rs @@ -1,8 +1,7 @@ use rustc_ast as ast; use rustc_ast::mut_visit::MutVisitor; use rustc_ast_pretty::pprust; -use rustc_span::create_default_session_globals_then; -use rustc_span::symbol::Ident; +use rustc_span::{Ident, create_default_session_globals_then}; use crate::parser::tests::{matches_codepattern, string_to_crate}; diff --git a/compiler/rustc_parse/src/parser/nonterminal.rs b/compiler/rustc_parse/src/parser/nonterminal.rs index 752a52b382b..67cabb757e9 100644 --- a/compiler/rustc_parse/src/parser/nonterminal.rs +++ b/compiler/rustc_parse/src/parser/nonterminal.rs @@ -9,7 +9,7 @@ use rustc_ast::token::{ use rustc_ast_pretty::pprust; use rustc_data_structures::sync::Lrc; use rustc_errors::PResult; -use rustc_span::symbol::{Ident, kw}; +use rustc_span::{Ident, kw}; use crate::errors::UnexpectedNonterminal; use crate::parser::pat::{CommaRecoveryMode, RecoverColon, RecoverComma}; diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index 255be721525..76101914bbd 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -13,8 +13,7 @@ use rustc_ast_pretty::pprust; use rustc_errors::{Applicability, Diag, DiagArgValue, PResult, StashKey}; use rustc_session::errors::ExprParenthesesNeeded; use rustc_span::source_map::{Spanned, respan}; -use rustc_span::symbol::{Ident, kw, sym}; -use rustc_span::{BytePos, ErrorGuaranteed, Span}; +use rustc_span::{BytePos, ErrorGuaranteed, Ident, Span, kw, sym}; use thin_vec::{ThinVec, thin_vec}; use super::{ForceCollect, Parser, PathStyle, Restrictions, Trailing, UsePreAttrPos}; diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index 6a7029a8f1c..f2f0c6dfad5 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -9,8 +9,7 @@ use rustc_ast::{ Path, PathSegment, QSelf, }; use rustc_errors::{Applicability, Diag, PResult}; -use rustc_span::symbol::{Ident, kw, sym}; -use rustc_span::{BytePos, Span}; +use rustc_span::{BytePos, Ident, Span, kw, sym}; use thin_vec::ThinVec; use tracing::debug; diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index 5fa2e01fc86..0f32e396273 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -12,8 +12,7 @@ use rustc_ast::{ LocalKind, MacCall, MacCallStmt, MacStmtStyle, Recovered, Stmt, StmtKind, }; use rustc_errors::{Applicability, Diag, PResult}; -use rustc_span::symbol::{Ident, kw, sym}; -use rustc_span::{BytePos, ErrorGuaranteed, Span}; +use rustc_span::{BytePos, ErrorGuaranteed, Ident, Span, kw, sym}; use thin_vec::{ThinVec, thin_vec}; use super::attr::InnerAttrForbiddenReason; diff --git a/compiler/rustc_parse/src/parser/tests.rs b/compiler/rustc_parse/src/parser/tests.rs index 1813960dad0..ca9e78be201 100644 --- a/compiler/rustc_parse/src/parser/tests.rs +++ b/compiler/rustc_parse/src/parser/tests.rs @@ -18,8 +18,9 @@ use rustc_errors::emitter::{HumanEmitter, OutputTheme}; use rustc_errors::{DiagCtxt, MultiSpan, PResult}; use rustc_session::parse::ParseSess; use rustc_span::source_map::{FilePathMapping, SourceMap}; -use rustc_span::symbol::{Symbol, kw, sym}; -use rustc_span::{BytePos, FileName, Pos, Span, create_default_session_globals_then}; +use rustc_span::{ + BytePos, FileName, Pos, Span, Symbol, create_default_session_globals_then, kw, sym, +}; use termcolor::WriteColor; use crate::parser::{ForceCollect, Parser}; diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index f696074e66a..6e720db4edf 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -8,8 +8,7 @@ use rustc_ast::{ TyKind, UnsafeBinderTy, }; use rustc_errors::{Applicability, PResult}; -use rustc_span::symbol::{Ident, kw, sym}; -use rustc_span::{ErrorGuaranteed, Span}; +use rustc_span::{ErrorGuaranteed, Ident, Span, kw, sym}; use thin_vec::{ThinVec, thin_vec}; use super::{Parser, PathStyle, SeqSep, TokenType, Trailing}; |
