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

@ -1,6 +1,6 @@
use rustc_ast::attr::{AttributeExt, filter_by_name};
use rustc_session::Session;
use rustc_span::symbol::{Symbol, sym};
use rustc_span::{Symbol, sym};
use crate::session_diagnostics;

View file

@ -9,8 +9,7 @@ use rustc_session::config::ExpectedValues;
use rustc_session::lint::BuiltinLintDiag;
use rustc_session::lint::builtin::UNEXPECTED_CFGS;
use rustc_session::parse::feature_err;
use rustc_span::Span;
use rustc_span::symbol::{Symbol, kw, sym};
use rustc_span::{Span, Symbol, kw, sym};
use crate::util::UnsupportedLiteralReason;
use crate::{fluent_generated, parse_version, session_diagnostics};

View file

@ -2,7 +2,7 @@
use rustc_ast::MetaItemInner;
use rustc_ast::attr::AttributeExt;
use rustc_span::symbol::Symbol;
use rustc_span::Symbol;
/// Read the content of a `rustc_confusables` attribute, and return the list of candidate names.
pub fn parse_confusables(attr: &impl AttributeExt) -> Option<Vec<Symbol>> {

View file

@ -6,8 +6,7 @@ use rustc_ast_pretty::pprust;
use rustc_attr_data_structures::{DeprecatedSince, Deprecation};
use rustc_feature::Features;
use rustc_session::Session;
use rustc_span::Span;
use rustc_span::symbol::{Symbol, sym};
use rustc_span::{Span, Symbol, sym};
use super::util::UnsupportedLiteralReason;
use crate::{parse_version, session_diagnostics};

View file

@ -6,7 +6,7 @@ use rustc_ast::{self as ast, MetaItemKind};
use rustc_attr_data_structures::IntType;
use rustc_attr_data_structures::ReprAttr::*;
use rustc_session::Session;
use rustc_span::symbol::{Symbol, sym};
use rustc_span::{Symbol, sym};
use crate::ReprAttr;
use crate::session_diagnostics::{self, IncorrectReprFormatGenericCause};

View file

@ -11,8 +11,7 @@ use rustc_attr_data_structures::{
};
use rustc_errors::ErrorGuaranteed;
use rustc_session::Session;
use rustc_span::Span;
use rustc_span::symbol::{Symbol, sym};
use rustc_span::{Span, Symbol, sym};
use crate::attributes::util::UnsupportedLiteralReason;
use crate::{parse_version, session_diagnostics};

View file

@ -1,7 +1,7 @@
use rustc_ast::attr::{AttributeExt, first_attr_value_str_by_name};
use rustc_attr_data_structures::RustcVersion;
use rustc_feature::is_builtin_attr_name;
use rustc_span::symbol::{Symbol, sym};
use rustc_span::{Symbol, sym};
pub(crate) enum UnsupportedLiteralReason {
Generic,