1
Fork 0

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:
Nicholas Nethercote 2024-12-13 10:29:23 +11:00
parent 7e6bf003f3
commit 2620eb42d7
335 changed files with 371 additions and 617 deletions

View file

@ -29,8 +29,7 @@ use rustc_session::lint::{self, BuiltinLintDiag};
use rustc_session::output::validate_crate_name;
use rustc_session::search_paths::PathKind;
use rustc_span::edition::Edition;
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, Target, TargetTuple};
use tracing::{debug, info, trace};

View file

@ -229,8 +229,7 @@ use rustc_session::cstore::CrateSource;
use rustc_session::filesearch::FileSearch;
use rustc_session::search_paths::PathKind;
use rustc_session::utils::CanonicalizedPath;
use rustc_span::Span;
use rustc_span::symbol::Symbol;
use rustc_span::{Span, Symbol};
use rustc_target::spec::{Target, TargetTuple};
use tracing::{debug, info};

View file

@ -16,7 +16,7 @@ use rustc_session::parse::feature_err;
use rustc_session::search_paths::PathKind;
use rustc_session::utils::NativeLibKind;
use rustc_span::def_id::{DefId, LOCAL_CRATE};
use rustc_span::symbol::{Symbol, sym};
use rustc_span::{Symbol, sym};
use rustc_target::spec::LinkSelfContainedComponents;
use crate::{errors, fluent_generated};

View file

@ -31,8 +31,7 @@ use rustc_serialize::{Decodable, Decoder};
use rustc_session::Session;
use rustc_session::cstore::{CrateSource, ExternCrate};
use rustc_span::hygiene::HygieneDecodeContext;
use rustc_span::symbol::kw;
use rustc_span::{BytePos, DUMMY_SP, Pos, SpanData, SpanDecoder, SyntaxContext};
use rustc_span::{BytePos, DUMMY_SP, Pos, SpanData, SpanDecoder, SyntaxContext, kw};
use tracing::debug;
use crate::creader::CStore;
@ -874,7 +873,7 @@ impl MetadataBlob {
let def_key = root.tables.def_keys.get(blob, item).unwrap().decode(blob);
#[cfg_attr(not(bootstrap), allow(rustc::symbol_intern_string_literal))]
let def_name = if item == CRATE_DEF_INDEX {
rustc_span::symbol::kw::Crate
kw::Crate
} else {
def_key
.disambiguated_data

View file

@ -17,9 +17,8 @@ use rustc_middle::ty::{self, TyCtxt};
use rustc_middle::util::Providers;
use rustc_session::cstore::{CrateStore, ExternCrate};
use rustc_session::{Session, StableCrateId};
use rustc_span::Span;
use rustc_span::hygiene::ExpnId;
use rustc_span::symbol::{Symbol, kw};
use rustc_span::{Span, Symbol, kw};
use super::{Decodable, DecodeContext, DecodeIterator};
use crate::creader::{CStore, LoadedMacro};

View file

@ -27,9 +27,9 @@ use rustc_middle::{bug, span_bug};
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder, opaque};
use rustc_session::config::{CrateType, OptLevel};
use rustc_span::hygiene::HygieneEncodeContext;
use rustc_span::symbol::sym;
use rustc_span::{
ExternalSource, FileName, SourceFile, SpanData, SpanEncoder, StableSourceFileId, SyntaxContext,
sym,
};
use tracing::{debug, instrument, trace};

View file

@ -36,8 +36,7 @@ use rustc_session::config::SymbolManglingVersion;
use rustc_session::cstore::{CrateDepKind, ForeignModule, LinkagePreference, NativeLib};
use rustc_span::edition::Edition;
use rustc_span::hygiene::{ExpnIndex, MacroKind, SyntaxContextData};
use rustc_span::symbol::{Ident, Symbol};
use rustc_span::{self, ExpnData, ExpnHash, ExpnId, Span};
use rustc_span::{self, ExpnData, ExpnHash, ExpnId, Ident, Span, Symbol};
use rustc_target::spec::{PanicStrategy, TargetTuple};
use table::TableBuilder;
use {rustc_ast as ast, rustc_attr_parsing as attr, rustc_hir as hir};