1
Fork 0

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`
This commit is contained in:
bors 2024-12-18 02:56:38 +00:00
commit a89ca2c85e
335 changed files with 371 additions and 617 deletions

View file

@ -17,8 +17,7 @@ use rustc_middle::ty::{
self, GenericArg, GenericArgKind, GenericArgsRef, InferConst, IsSuggestable, Ty, TyCtxt,
TypeFoldable, TypeFolder, TypeSuperFoldable, TypeckResults,
};
use rustc_span::symbol::{Ident, sym};
use rustc_span::{BytePos, DUMMY_SP, FileName, Span};
use rustc_span::{BytePos, DUMMY_SP, FileName, Ident, Span, sym};
use tracing::{debug, instrument, warn};
use super::nice_region_error::placeholder_error::Highlighted;

View file

@ -3,7 +3,7 @@
use rustc_errors::Diag;
use rustc_middle::ty;
use rustc_span::symbol::kw;
use rustc_span::kw;
use tracing::debug;
use crate::error_reporting::infer::nice_region_error::NiceRegionError;

View file

@ -11,9 +11,8 @@ use rustc_hir::{
use rustc_middle::ty::{
self, AssocItemContainer, StaticLifetimeVisitor, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor,
};
use rustc_span::Span;
use rustc_span::def_id::LocalDefId;
use rustc_span::symbol::Ident;
use rustc_span::{Ident, Span};
use tracing::debug;
use crate::error_reporting::infer::nice_region_error::NiceRegionError;

View file

@ -3,7 +3,7 @@ use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_middle::traits::ObligationCauseCode;
use rustc_middle::ty::error::TypeError;
use rustc_middle::ty::{self, IsSuggestable, Region, Ty};
use rustc_span::symbol::kw;
use rustc_span::kw;
use tracing::debug;
use super::ObligationCauseAsDiagArg;

View file

@ -12,8 +12,7 @@ use rustc_middle::bug;
use rustc_middle::traits::ObligationCauseCode;
use rustc_middle::ty::error::TypeError;
use rustc_middle::ty::{self, IsSuggestable, Region, Ty, TyCtxt, TypeVisitableExt as _};
use rustc_span::symbol::kw;
use rustc_span::{BytePos, ErrorGuaranteed, Span, Symbol};
use rustc_span::{BytePos, ErrorGuaranteed, Span, Symbol, kw};
use rustc_type_ir::Upcast as _;
use tracing::{debug, instrument};

View file

@ -27,8 +27,7 @@ use rustc_middle::ty::{
self, ToPolyTraitRef, TraitRef, Ty, TyCtxt, TypeFoldable, TypeVisitableExt, Upcast,
};
use rustc_middle::{bug, span_bug};
use rustc_span::symbol::sym;
use rustc_span::{BytePos, DUMMY_SP, Span, Symbol};
use rustc_span::{BytePos, DUMMY_SP, Span, Symbol, sym};
use tracing::{debug, instrument};
use super::on_unimplemented::{AppendConstMessage, OnUnimplementedNote};

View file

@ -13,8 +13,7 @@ use rustc_middle::ty::print::PrintTraitRefExt as _;
use rustc_middle::ty::{self, GenericArgsRef, GenericParamDefKind, ToPolyTraitRef, TyCtxt};
use rustc_parse_format::{ParseMode, Parser, Piece, Position};
use rustc_session::lint::builtin::UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES;
use rustc_span::Span;
use rustc_span::symbol::{Symbol, kw, sym};
use rustc_span::{Span, Symbol, kw, sym};
use tracing::{debug, info};
use {rustc_attr_parsing as attr, rustc_hir as hir};

View file

@ -38,8 +38,9 @@ use rustc_middle::ty::{
};
use rustc_middle::{bug, span_bug};
use rustc_span::def_id::LocalDefId;
use rustc_span::symbol::{Ident, Symbol, kw, sym};
use rustc_span::{BytePos, DUMMY_SP, DesugaringKind, ExpnKind, MacroKind, Span};
use rustc_span::{
BytePos, DUMMY_SP, DesugaringKind, ExpnKind, Ident, MacroKind, Span, Symbol, kw, sym,
};
use tracing::{debug, instrument};
use super::{

View file

@ -14,8 +14,7 @@ use rustc_hir::{FnRetTy, GenericParamKind, Node};
use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_middle::ty::print::{PrintTraitRefExt as _, TraitRefPrintOnlyTraitPath};
use rustc_middle::ty::{self, Binder, ClosureKind, FnSig, PolyTraitRef, Region, Ty, TyCtxt};
use rustc_span::symbol::{Ident, Symbol, kw};
use rustc_span::{BytePos, Span};
use rustc_span::{BytePos, Ident, Span, Symbol, kw};
use crate::error_reporting::infer::ObligationCauseAsDiagArg;
use crate::error_reporting::infer::need_type_info::UnderspecifiedArgKind;

View file

@ -2,8 +2,7 @@ use rustc_errors::{Diag, EmissionGuarantee, IntoDiagArg, SubdiagMessageOp, Subdi
use rustc_hir::def_id::LocalDefId;
use rustc_middle::bug;
use rustc_middle::ty::{self, TyCtxt};
use rustc_span::Span;
use rustc_span::symbol::kw;
use rustc_span::{Span, kw};
use crate::error_reporting::infer::nice_region_error::find_anon_type;
use crate::fluent_generated as fluent;

View file

@ -21,8 +21,7 @@ use rustc_middle::ty::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitableEx
use rustc_middle::ty::{self, Ty, TyCtxt, TypingMode};
pub use rustc_next_trait_solver::coherence::*;
use rustc_next_trait_solver::solve::SolverDelegateEvalExt;
use rustc_span::symbol::sym;
use rustc_span::{DUMMY_SP, Span};
use rustc_span::{DUMMY_SP, Span, sym};
use tracing::{debug, instrument, warn};
use super::ObligationCtxt;

View file

@ -17,7 +17,7 @@ use rustc_middle::ty::fold::TypeFoldable;
use rustc_middle::ty::visit::TypeVisitableExt;
use rustc_middle::ty::{self, Term, Ty, TyCtxt, TypingMode, Upcast};
use rustc_middle::{bug, span_bug};
use rustc_span::symbol::sym;
use rustc_span::sym;
use thin_vec::thin_vec;
use tracing::{debug, instrument};

View file

@ -31,8 +31,7 @@ use rustc_middle::ty::{
self, GenericArgsRef, PolyProjectionPredicate, Ty, TyCtxt, TypeFoldable, TypeVisitableExt,
TypingMode, Upcast,
};
use rustc_span::Symbol;
use rustc_span::symbol::sym;
use rustc_span::{Symbol, sym};
use tracing::{debug, instrument, trace};
use self::EvaluationResult::*;