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 in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
This commit is contained in:
parent
7e6bf003f3
commit
2620eb42d7
335 changed files with 371 additions and 617 deletions
|
@ -3,8 +3,7 @@ use rustc_ast::{
|
|||
self as ast, Fn, FnHeader, FnSig, Generics, ItemKind, Safety, Stmt, StmtKind, TyKind,
|
||||
};
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::{Ident, kw, sym};
|
||||
use rustc_span::{Ident, Span, kw, sym};
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
|
||||
use crate::errors;
|
||||
|
|
|
@ -10,8 +10,7 @@ use rustc_expand::base::*;
|
|||
use rustc_index::bit_set::GrowableBitSet;
|
||||
use rustc_parse::parser::Parser;
|
||||
use rustc_session::lint;
|
||||
use rustc_span::symbol::{Ident, Symbol, kw, sym};
|
||||
use rustc_span::{ErrorGuaranteed, InnerSpan, Span};
|
||||
use rustc_span::{ErrorGuaranteed, Ident, InnerSpan, Span, Symbol, kw, sym};
|
||||
use rustc_target::asm::InlineAsmArch;
|
||||
use smallvec::smallvec;
|
||||
use {rustc_ast as ast, rustc_parse_format as parse};
|
||||
|
|
|
@ -8,8 +8,7 @@ use rustc_ast_pretty::pprust;
|
|||
use rustc_errors::PResult;
|
||||
use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacEager, MacroExpanderResult};
|
||||
use rustc_parse::parser::Parser;
|
||||
use rustc_span::symbol::{Ident, Symbol, sym};
|
||||
use rustc_span::{DUMMY_SP, Span};
|
||||
use rustc_span::{DUMMY_SP, Ident, Span, Symbol, sym};
|
||||
use thin_vec::thin_vec;
|
||||
|
||||
use crate::edition_panic::use_panic_2021;
|
||||
|
|
|
@ -8,8 +8,7 @@ use rustc_ast::{
|
|||
use rustc_ast_pretty::pprust;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_expand::base::ExtCtxt;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::{Ident, Symbol, sym};
|
||||
use rustc_span::{Ident, Span, Symbol, sym};
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
|
||||
pub(super) struct Context<'cx, 'a> {
|
||||
|
|
|
@ -20,8 +20,7 @@ mod llvm_enzyme {
|
|||
PatKind, TyKind,
|
||||
};
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_span::symbol::{Ident, kw, sym};
|
||||
use rustc_span::{Span, Symbol};
|
||||
use rustc_span::{Ident, Span, Symbol, kw, sym};
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
use tracing::{debug, trace};
|
||||
|
||||
|
@ -35,7 +34,7 @@ mod llvm_enzyme {
|
|||
FnRetTy::Default(_) => false,
|
||||
}
|
||||
}
|
||||
fn first_ident(x: &MetaItemInner) -> rustc_span::symbol::Ident {
|
||||
fn first_ident(x: &MetaItemInner) -> rustc_span::Ident {
|
||||
let segments = &x.meta_item().unwrap().path.segments;
|
||||
assert!(segments.len() == 1);
|
||||
segments[0].ident
|
||||
|
|
|
@ -4,8 +4,7 @@ use rustc_ast as ast;
|
|||
use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt, Indeterminate, MultiItemModifier};
|
||||
use rustc_feature::AttributeTemplate;
|
||||
use rustc_parse::validate_attr;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, sym};
|
||||
|
||||
use crate::errors;
|
||||
|
||||
|
|
|
@ -12,8 +12,7 @@ use rustc_expand::configure;
|
|||
use rustc_feature::Features;
|
||||
use rustc_parse::parser::{ForceCollect, Parser};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, sym};
|
||||
use smallvec::SmallVec;
|
||||
use tracing::instrument;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ use rustc_ast::tokenstream::TokenStream;
|
|||
use rustc_ast::{ExprKind, LitKind, UnOp};
|
||||
use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacEager, MacroExpanderResult};
|
||||
use rustc_session::errors::report_lit_error;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::Symbol;
|
||||
|
||||
use crate::errors;
|
||||
use crate::util::get_exprs_from_tts;
|
||||
|
|
|
@ -3,8 +3,7 @@ use rustc_ast::token::{self, Token};
|
|||
use rustc_ast::tokenstream::{TokenStream, TokenTree};
|
||||
use rustc_ast::{AttrVec, DUMMY_NODE_ID, Expr, ExprKind, Path, Ty, TyKind};
|
||||
use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacResult, MacroExpanderResult};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::{Ident, Symbol};
|
||||
use rustc_span::{Ident, Span, Symbol};
|
||||
|
||||
use crate::errors;
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@ use rustc_expand::base::{
|
|||
use rustc_feature::AttributeTemplate;
|
||||
use rustc_parse::validate_attr;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::{Ident, sym};
|
||||
use rustc_span::{ErrorGuaranteed, Span};
|
||||
use rustc_span::{ErrorGuaranteed, Ident, Span, sym};
|
||||
|
||||
use crate::cfg_eval::cfg_eval;
|
||||
use crate::errors;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
use rustc_ast::{self as ast, Generics, ItemKind, MetaItem, VariantData};
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::{Ident, kw, sym};
|
||||
use rustc_span::{Ident, Span, kw, sym};
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
|
||||
use crate::deriving::generic::ty::*;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
use rustc_ast::{self as ast, MetaItem};
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, sym};
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
|
||||
use crate::deriving::generic::ty::*;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use rustc_ast::MetaItem;
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::{Ident, sym};
|
||||
use rustc_span::{Ident, Span, sym};
|
||||
use thin_vec::thin_vec;
|
||||
|
||||
use crate::deriving::generic::ty::*;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::{BinOpKind, BorrowKind, Expr, ExprKind, MetaItem, Mutability};
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, sym};
|
||||
use thin_vec::thin_vec;
|
||||
|
||||
use crate::deriving::generic::ty::*;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use rustc_ast::{ExprKind, ItemKind, MetaItem, PatKind};
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::{Ident, sym};
|
||||
use rustc_span::{Ident, Span, sym};
|
||||
use thin_vec::thin_vec;
|
||||
|
||||
use crate::deriving::generic::ty::*;
|
||||
|
|
|
@ -10,8 +10,7 @@ use rustc_attr_parsing as attr;
|
|||
use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_macros::Diagnostic;
|
||||
use rustc_span::symbol::{Ident, sym};
|
||||
use rustc_span::{Span, Symbol};
|
||||
use rustc_span::{Ident, Span, Symbol, sym};
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
|
||||
use crate::errors;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
use rustc_ast::{self as ast, EnumDef, MetaItem};
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_session::config::FmtDebug;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::{Ident, Symbol, sym};
|
||||
use rustc_span::{Ident, Span, Symbol, sym};
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
|
||||
use crate::deriving::generic::ty::*;
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::{self as ast, Expr, MetaItem, Mutability};
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::{Ident, Symbol, sym};
|
||||
use rustc_span::{Ident, Span, Symbol, sym};
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
|
||||
use crate::deriving::generic::ty::*;
|
||||
|
|
|
@ -4,8 +4,7 @@ use rustc_ast as ast;
|
|||
use rustc_ast::visit::visit_opt;
|
||||
use rustc_ast::{EnumDef, VariantData, attr};
|
||||
use rustc_expand::base::{Annotatable, DummyResult, ExtCtxt};
|
||||
use rustc_span::symbol::{Ident, kw, sym};
|
||||
use rustc_span::{ErrorGuaranteed, Span};
|
||||
use rustc_span::{ErrorGuaranteed, Ident, Span, kw, sym};
|
||||
use smallvec::SmallVec;
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
|
||||
|
|
|
@ -87,8 +87,7 @@
|
|||
|
||||
use rustc_ast::{AttrVec, ExprKind, MetaItem, Mutability};
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::{Ident, Symbol, sym};
|
||||
use rustc_span::{Ident, Span, Symbol, sym};
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
|
||||
use crate::deriving::generic::ty::*;
|
||||
|
|
|
@ -187,8 +187,7 @@ use rustc_ast::{
|
|||
};
|
||||
use rustc_attr_parsing as attr;
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
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, thin_vec};
|
||||
use ty::{Bounds, Path, Ref, Self_, Ty};
|
||||
|
||||
|
|
|
@ -6,8 +6,7 @@ use rustc_ast::ptr::P;
|
|||
use rustc_ast::{self as ast, Expr, GenericArg, GenericParamKind, Generics, SelfKind};
|
||||
use rustc_expand::base::ExtCtxt;
|
||||
use rustc_span::source_map::respan;
|
||||
use rustc_span::symbol::{Ident, Symbol, kw};
|
||||
use rustc_span::{DUMMY_SP, Span};
|
||||
use rustc_span::{DUMMY_SP, Ident, Span, Symbol, kw};
|
||||
use thin_vec::ThinVec;
|
||||
|
||||
/// A path, e.g., `::std::option::Option::<i32>` (global). Has support
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use rustc_ast::{MetaItem, Mutability};
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, sym};
|
||||
use thin_vec::thin_vec;
|
||||
|
||||
use crate::deriving::generic::ty::*;
|
||||
|
|
|
@ -4,8 +4,7 @@ use rustc_ast as ast;
|
|||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::{GenericArg, MetaItem};
|
||||
use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt, MultiItemModifier};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::{Symbol, sym};
|
||||
use rustc_span::{Span, Symbol, sym};
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
|
||||
macro path_local($x:ident) {
|
||||
|
|
|
@ -3,9 +3,8 @@ use rustc_ast::token::Delimiter;
|
|||
use rustc_ast::tokenstream::{DelimSpan, TokenStream};
|
||||
use rustc_ast::*;
|
||||
use rustc_expand::base::*;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, sym};
|
||||
|
||||
/// This expands to either
|
||||
/// - `$crate::panic::panic_2015!(...)` or
|
||||
|
|
|
@ -10,8 +10,7 @@ use rustc_ast::token::{self, LitKind};
|
|||
use rustc_ast::tokenstream::TokenStream;
|
||||
use rustc_ast::{AstDeref, ExprKind, GenericArg, Mutability};
|
||||
use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacEager, MacroExpanderResult};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::{Ident, Symbol, kw, sym};
|
||||
use rustc_span::{Ident, Span, Symbol, kw, sym};
|
||||
use thin_vec::thin_vec;
|
||||
|
||||
use crate::errors;
|
||||
|
|
|
@ -4,8 +4,7 @@ use rustc_errors::{
|
|||
SubdiagMessageOp, Subdiagnostic,
|
||||
};
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::{Span, Symbol};
|
||||
use rustc_span::{Ident, Span, Symbol};
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(builtin_macros_requires_cfg_pattern)]
|
||||
|
|
|
@ -13,8 +13,7 @@ use rustc_expand::base::*;
|
|||
use rustc_lint_defs::builtin::NAMED_ARGUMENTS_USED_POSITIONALLY;
|
||||
use rustc_lint_defs::{BufferedEarlyLint, BuiltinLintDiag, LintId};
|
||||
use rustc_parse_format as parse;
|
||||
use rustc_span::symbol::{Ident, Symbol};
|
||||
use rustc_span::{BytePos, ErrorGuaranteed, InnerSpan, Span};
|
||||
use rustc_span::{BytePos, ErrorGuaranteed, Ident, InnerSpan, Span, Symbol};
|
||||
|
||||
use crate::errors;
|
||||
use crate::util::expr_to_spanned_string;
|
||||
|
|
|
@ -7,8 +7,7 @@ use rustc_ast::{
|
|||
Stmt, StmtKind, Ty, TyKind,
|
||||
};
|
||||
use rustc_expand::base::{Annotatable, ExtCtxt};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::{Ident, Symbol, kw, sym};
|
||||
use rustc_span::{Ident, Span, Symbol, kw, sym};
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
|
||||
use crate::errors;
|
||||
|
|
|
@ -24,7 +24,7 @@ extern crate proc_macro;
|
|||
|
||||
use rustc_expand::base::{MacroExpanderFn, ResolverExpand, SyntaxExtensionKind};
|
||||
use rustc_expand::proc_macro::BangProcMacro;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::sym;
|
||||
|
||||
use crate::deriving::*;
|
||||
|
||||
|
|
|
@ -11,8 +11,7 @@ use rustc_feature::Features;
|
|||
use rustc_session::Session;
|
||||
use rustc_span::hygiene::AstPass;
|
||||
use rustc_span::source_map::SourceMap;
|
||||
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 smallvec::smallvec;
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
|
||||
|
|
|
@ -16,8 +16,7 @@ use rustc_parse::parser::{ForceCollect, Parser};
|
|||
use rustc_parse::{new_parser_from_file, unwrap_or_emit_fatal};
|
||||
use rustc_session::lint::builtin::INCOMPLETE_INCLUDE;
|
||||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::{Pos, Span};
|
||||
use rustc_span::{Pos, Span, Symbol};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
use crate::errors;
|
||||
|
|
|
@ -3,10 +3,9 @@ use rustc_expand::base::{ExtCtxt, ResolverExpand};
|
|||
use rustc_expand::expand::ExpansionConfig;
|
||||
use rustc_feature::Features;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::DUMMY_SP;
|
||||
use rustc_span::edition::Edition::*;
|
||||
use rustc_span::hygiene::AstPass;
|
||||
use rustc_span::symbol::{Ident, Symbol, kw, sym};
|
||||
use rustc_span::{DUMMY_SP, Ident, Symbol, kw, sym};
|
||||
use thin_vec::thin_vec;
|
||||
|
||||
pub fn inject(
|
||||
|
|
|
@ -9,8 +9,7 @@ use rustc_ast::{self as ast, GenericParamKind, attr};
|
|||
use rustc_ast_pretty::pprust;
|
||||
use rustc_errors::{Applicability, Diag, Level};
|
||||
use rustc_expand::base::*;
|
||||
use rustc_span::symbol::{Ident, Symbol, sym};
|
||||
use rustc_span::{ErrorGuaranteed, FileNameDisplayPreference, Span};
|
||||
use rustc_span::{ErrorGuaranteed, FileNameDisplayPreference, Ident, Span, Symbol, sym};
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
use tracing::debug;
|
||||
|
||||
|
|
|
@ -16,8 +16,7 @@ use rustc_lint_defs::BuiltinLintDiag;
|
|||
use rustc_session::Session;
|
||||
use rustc_session::lint::builtin::UNNAMEABLE_TEST_ITEMS;
|
||||
use rustc_span::hygiene::{AstPass, SyntaxContext, Transparency};
|
||||
use rustc_span::symbol::{Ident, Symbol, sym};
|
||||
use rustc_span::{DUMMY_SP, Span};
|
||||
use rustc_span::{DUMMY_SP, Ident, Span, Symbol, sym};
|
||||
use rustc_target::spec::PanicStrategy;
|
||||
use smallvec::smallvec;
|
||||
use thin_vec::{ThinVec, thin_vec};
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use rustc_ast::tokenstream::{TokenStream, TokenTree};
|
||||
use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacroExpanderResult};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_span::{Span, kw};
|
||||
|
||||
use crate::errors;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue