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
|
@ -5,7 +5,7 @@ use rustc_middle::span_bug;
|
|||
use rustc_middle::ty::layout::{FnAbiError, LayoutError};
|
||||
use rustc_middle::ty::{self, GenericArgs, Instance, Ty, TyCtxt};
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::sym;
|
||||
use rustc_target::abi::call::FnAbi;
|
||||
|
||||
use super::layout_test::ensure_wf;
|
||||
|
|
|
@ -30,8 +30,7 @@ use rustc_session::lint::builtin::{
|
|||
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES, UNUSED_ATTRIBUTES,
|
||||
};
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_span::symbol::{Symbol, kw, sym};
|
||||
use rustc_span::{BytePos, DUMMY_SP, Span};
|
||||
use rustc_span::{BytePos, DUMMY_SP, Span, Symbol, kw, sym};
|
||||
use rustc_target::abi::Size;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
|
||||
|
|
|
@ -22,7 +22,7 @@ use rustc_middle::ty::{self, TyCtxt};
|
|||
use rustc_middle::{bug, span_bug};
|
||||
use rustc_session::lint;
|
||||
use rustc_session::lint::builtin::DEAD_CODE;
|
||||
use rustc_span::symbol::{Symbol, sym};
|
||||
use rustc_span::{Symbol, sym};
|
||||
|
||||
use crate::errors::{
|
||||
ChangeFields, IgnoredDerivedImpls, MultipleDeadCodes, ParentInfo, UselessAssignment,
|
||||
|
|
|
@ -14,7 +14,7 @@ use rustc_hir::{Attribute, OwnerId};
|
|||
use rustc_middle::query::{LocalCrate, Providers};
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_span::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc_span::symbol::{Symbol, sym};
|
||||
use rustc_span::{Symbol, sym};
|
||||
|
||||
use crate::errors::DuplicateDiagnosticItemInCrate;
|
||||
|
||||
|
|
|
@ -8,8 +8,7 @@ use rustc_middle::query::Providers;
|
|||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::RemapFileNameExt;
|
||||
use rustc_session::config::{CrateType, EntryFnType, RemapPathScopeComponents, sigpipe};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, Symbol};
|
||||
use rustc_span::{Span, Symbol, sym};
|
||||
|
||||
use crate::errors::{
|
||||
AttrOnlyInFunctions, ExternMain, MultipleRustcMain, MultipleStartFunctions, NoMainErr,
|
||||
|
|
|
@ -16,8 +16,7 @@ use rustc_hir::{LangItem, LanguageItems, MethodKind, Target};
|
|||
use rustc_middle::query::Providers;
|
||||
use rustc_middle::ty::{ResolverAstLowering, TyCtxt};
|
||||
use rustc_session::cstore::ExternCrate;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::kw::Empty;
|
||||
use rustc_span::{Span, kw};
|
||||
|
||||
use crate::errors::{
|
||||
DuplicateLangItem, IncorrectTarget, LangItemOnIncorrectTarget, UnknownLangItem,
|
||||
|
@ -99,7 +98,7 @@ impl<'ast, 'tcx> LanguageItemCollector<'ast, 'tcx> {
|
|||
{
|
||||
let lang_item_name = lang_item.name();
|
||||
let crate_name = self.tcx.crate_name(item_def_id.krate);
|
||||
let mut dependency_of = Empty;
|
||||
let mut dependency_of = kw::Empty;
|
||||
let is_local = item_def_id.is_local();
|
||||
let path = if is_local {
|
||||
String::new()
|
||||
|
@ -113,8 +112,8 @@ impl<'ast, 'tcx> LanguageItemCollector<'ast, 'tcx> {
|
|||
};
|
||||
|
||||
let first_defined_span = self.item_spans.get(&original_def_id).copied();
|
||||
let mut orig_crate_name = Empty;
|
||||
let mut orig_dependency_of = Empty;
|
||||
let mut orig_crate_name = kw::Empty;
|
||||
let mut orig_dependency_of = kw::Empty;
|
||||
let orig_is_local = original_def_id.is_local();
|
||||
let orig_path = if orig_is_local {
|
||||
String::new()
|
||||
|
|
|
@ -5,9 +5,8 @@ use rustc_hir::def_id::LocalDefId;
|
|||
use rustc_middle::span_bug;
|
||||
use rustc_middle::ty::layout::{HasTyCtxt, HasTypingEnv, LayoutError, LayoutOfHelpers};
|
||||
use rustc_middle::ty::{self, Ty, TyCtxt};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, sym};
|
||||
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
|
||||
use rustc_trait_selection::infer::TyCtxtInferExt;
|
||||
use rustc_trait_selection::traits;
|
||||
|
|
|
@ -11,8 +11,7 @@ use rustc_middle::hir::nested_filter;
|
|||
use rustc_middle::middle::lib_features::{FeatureStability, LibFeatures};
|
||||
use rustc_middle::query::{LocalCrate, Providers};
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::{Span, sym};
|
||||
use rustc_span::{Span, Symbol, sym};
|
||||
|
||||
use crate::errors::{FeaturePreviouslyDeclared, FeatureStableTwice};
|
||||
|
||||
|
|
|
@ -96,8 +96,7 @@ use rustc_middle::query::Providers;
|
|||
use rustc_middle::span_bug;
|
||||
use rustc_middle::ty::{self, RootVariableMinCaptureList, Ty, TyCtxt};
|
||||
use rustc_session::lint;
|
||||
use rustc_span::symbol::{Symbol, kw, sym};
|
||||
use rustc_span::{BytePos, Span};
|
||||
use rustc_span::{BytePos, Span, Symbol, kw, sym};
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use self::LiveNodeKind::*;
|
||||
|
|
|
@ -10,8 +10,7 @@ use rustc_middle::query::Providers;
|
|||
use rustc_middle::span_bug;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::lint::builtin::UNDEFINED_NAKED_FUNCTION_ABI;
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, sym};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
use crate::errors::{
|
||||
|
|
|
@ -25,8 +25,7 @@ use rustc_middle::query::Providers;
|
|||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::lint;
|
||||
use rustc_session::lint::builtin::{INEFFECTIVE_UNSTABLE_TRAIT_IMPL, USELESS_DEPRECATED};
|
||||
use rustc_span::Span;
|
||||
use rustc_span::symbol::{Symbol, sym};
|
||||
use rustc_span::{Span, Symbol, sym};
|
||||
use tracing::{debug, info};
|
||||
|
||||
use crate::errors;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue