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

@ -15,8 +15,7 @@ use rustc_middle::ty::{
suggest_constraining_type_param,
};
use rustc_middle::util::{CallDesugaringKind, CallKind, call_kind};
use rustc_span::symbol::sym;
use rustc_span::{BytePos, Pos, Span, Symbol};
use rustc_span::{BytePos, Pos, Span, Symbol, sym};
use rustc_trait_selection::traits::SelectionContext;
use tracing::debug;

View file

@ -1,7 +1,7 @@
use rustc_middle::mir::visit::Visitor;
use rustc_middle::mir::{self, BasicBlock, Location};
use rustc_middle::ty::TyCtxt;
use rustc_span::symbol::sym;
use rustc_span::sym;
use tracing::trace;
use super::ConstCx;

View file

@ -13,8 +13,7 @@ use rustc_middle::query::TyCtxtAt;
use rustc_middle::ty::layout::{HasTypingEnv, TyAndLayout};
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_middle::{bug, mir};
use rustc_span::Span;
use rustc_span::symbol::{Symbol, sym};
use rustc_span::{Span, Symbol, sym};
use tracing::debug;
use super::error::*;

View file

@ -11,7 +11,7 @@ use rustc_middle::mir::{self, BinOp, ConstValue, NonDivergingIntrinsic};
use rustc_middle::ty::layout::{LayoutOf as _, TyAndLayout, ValidityRequirement};
use rustc_middle::ty::{GenericArgsRef, Ty, TyCtxt};
use rustc_middle::{bug, ty};
use rustc_span::symbol::{Symbol, sym};
use rustc_span::{Symbol, sym};
use tracing::trace;
use super::memory::MemoryKind;

View file

@ -6,7 +6,7 @@ use rustc_middle::mir::interpret::{InterpResult, PointerArithmetic, Scalar};
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
use rustc_middle::ty::{self, FloatTy, ScalarInt, Ty};
use rustc_middle::{bug, mir, span_bug};
use rustc_span::symbol::sym;
use rustc_span::sym;
use tracing::trace;
use super::{ImmTy, InterpCx, Machine, MemPlaceMeta, interp_ok, throw_ub};

View file

@ -26,7 +26,7 @@ use rustc_middle::mir::interpret::{
};
use rustc_middle::ty::layout::{LayoutCx, LayoutOf, TyAndLayout};
use rustc_middle::ty::{self, Ty};
use rustc_span::symbol::{Symbol, sym};
use rustc_span::{Symbol, sym};
use tracing::trace;
use super::machine::AllocMap;

View file

@ -3,7 +3,7 @@ use rustc_middle::query::TyCtxtAt;
use rustc_middle::ty::layout::LayoutOf;
use rustc_middle::ty::{self};
use rustc_middle::{bug, mir};
use rustc_span::symbol::Symbol;
use rustc_span::Symbol;
use tracing::trace;
use crate::const_eval::{CanAccessMutGlobal, CompileTimeInterpCx, mk_eval_cx_to_read_const_val};