Rollup merge of #105770 - oli-obk:deref_all_the_things, r=compiler-errors
Rename ConstS to ConstData just a style nit to get it in sync with all the other interned datastructures
This commit is contained in:
commit
9b6605dcc4
6 changed files with 16 additions and 16 deletions
|
@ -93,7 +93,7 @@ macro_rules! arena_types {
|
||||||
// Interned types
|
// Interned types
|
||||||
[] tys: rustc_type_ir::WithCachedTypeInfo<rustc_middle::ty::TyKind<'tcx>>,
|
[] tys: rustc_type_ir::WithCachedTypeInfo<rustc_middle::ty::TyKind<'tcx>>,
|
||||||
[] predicates: rustc_type_ir::WithCachedTypeInfo<rustc_middle::ty::PredicateKind<'tcx>>,
|
[] predicates: rustc_type_ir::WithCachedTypeInfo<rustc_middle::ty::PredicateKind<'tcx>>,
|
||||||
[] consts: rustc_middle::ty::ConstS<'tcx>,
|
[] consts: rustc_middle::ty::ConstData<'tcx>,
|
||||||
|
|
||||||
// Note that this deliberately duplicates items in the `rustc_hir::arena`,
|
// Note that this deliberately duplicates items in the `rustc_hir::arena`,
|
||||||
// since we need to allocate this type on both the `rustc_hir` arena
|
// since we need to allocate this type on both the `rustc_hir` arena
|
||||||
|
|
|
@ -310,7 +310,7 @@ impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> RefDecodable<'tcx, D>
|
||||||
|
|
||||||
impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> Decodable<D> for ty::Const<'tcx> {
|
impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> Decodable<D> for ty::Const<'tcx> {
|
||||||
fn decode(decoder: &mut D) -> Self {
|
fn decode(decoder: &mut D) -> Self {
|
||||||
let consts: ty::ConstS<'tcx> = Decodable::decode(decoder);
|
let consts: ty::ConstData<'tcx> = Decodable::decode(decoder);
|
||||||
decoder.interner().mk_const(consts.kind, consts.ty)
|
decoder.interner().mk_const(consts.kind, consts.ty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,10 @@ pub use int::*;
|
||||||
pub use kind::*;
|
pub use kind::*;
|
||||||
pub use valtree::*;
|
pub use valtree::*;
|
||||||
|
|
||||||
/// Use this rather than `ConstS`, whenever possible.
|
/// Use this rather than `ConstData, whenever possible.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable)]
|
||||||
#[rustc_pass_by_value]
|
#[rustc_pass_by_value]
|
||||||
pub struct Const<'tcx>(pub Interned<'tcx, ConstS<'tcx>>);
|
pub struct Const<'tcx>(pub(super) Interned<'tcx, ConstData<'tcx>>);
|
||||||
|
|
||||||
impl<'tcx> fmt::Debug for Const<'tcx> {
|
impl<'tcx> fmt::Debug for Const<'tcx> {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
@ -30,13 +30,13 @@ impl<'tcx> fmt::Debug for Const<'tcx> {
|
||||||
|
|
||||||
/// Typed constant value.
|
/// Typed constant value.
|
||||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, HashStable, TyEncodable, TyDecodable)]
|
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, HashStable, TyEncodable, TyDecodable)]
|
||||||
pub struct ConstS<'tcx> {
|
pub struct ConstData<'tcx> {
|
||||||
pub ty: Ty<'tcx>,
|
pub ty: Ty<'tcx>,
|
||||||
pub kind: ConstKind<'tcx>,
|
pub kind: ConstKind<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||||
static_assert_size!(ConstS<'_>, 40);
|
static_assert_size!(ConstData<'_>, 40);
|
||||||
|
|
||||||
impl<'tcx> Const<'tcx> {
|
impl<'tcx> Const<'tcx> {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -17,7 +17,7 @@ use crate::thir::Thir;
|
||||||
use crate::traits;
|
use crate::traits;
|
||||||
use crate::ty::query::{self, TyCtxtAt};
|
use crate::ty::query::{self, TyCtxtAt};
|
||||||
use crate::ty::{
|
use crate::ty::{
|
||||||
self, AdtDef, AdtDefData, AdtKind, Binder, Const, ConstS, DefIdTree, FloatTy, FloatVar,
|
self, AdtDef, AdtDefData, AdtKind, Binder, Const, ConstData, DefIdTree, FloatTy, FloatVar,
|
||||||
FloatVid, GenericParamDefKind, ImplPolarity, InferTy, IntTy, IntVar, IntVid, List, ParamConst,
|
FloatVid, GenericParamDefKind, ImplPolarity, InferTy, IntTy, IntVar, IntVid, List, ParamConst,
|
||||||
ParamTy, PolyExistentialPredicate, PolyFnSig, Predicate, PredicateKind, Region, RegionKind,
|
ParamTy, PolyExistentialPredicate, PolyFnSig, Predicate, PredicateKind, Region, RegionKind,
|
||||||
ReprOptions, TraitObjectVisitor, Ty, TyKind, TyVar, TyVid, TypeAndMut, TypeckResults, UintTy,
|
ReprOptions, TraitObjectVisitor, Ty, TyKind, TyVar, TyVid, TypeAndMut, TypeckResults, UintTy,
|
||||||
|
@ -140,7 +140,7 @@ pub struct CtxtInterners<'tcx> {
|
||||||
predicates: InternedSet<'tcx, List<Predicate<'tcx>>>,
|
predicates: InternedSet<'tcx, List<Predicate<'tcx>>>,
|
||||||
projs: InternedSet<'tcx, List<ProjectionKind>>,
|
projs: InternedSet<'tcx, List<ProjectionKind>>,
|
||||||
place_elems: InternedSet<'tcx, List<PlaceElem<'tcx>>>,
|
place_elems: InternedSet<'tcx, List<PlaceElem<'tcx>>>,
|
||||||
const_: InternedSet<'tcx, ConstS<'tcx>>,
|
const_: InternedSet<'tcx, ConstData<'tcx>>,
|
||||||
const_allocation: InternedSet<'tcx, Allocation>,
|
const_allocation: InternedSet<'tcx, Allocation>,
|
||||||
bound_variable_kinds: InternedSet<'tcx, List<ty::BoundVariableKind>>,
|
bound_variable_kinds: InternedSet<'tcx, List<ty::BoundVariableKind>>,
|
||||||
layout: InternedSet<'tcx, LayoutS<VariantIdx>>,
|
layout: InternedSet<'tcx, LayoutS<VariantIdx>>,
|
||||||
|
@ -331,7 +331,7 @@ impl<'tcx> CommonConsts<'tcx> {
|
||||||
};
|
};
|
||||||
|
|
||||||
CommonConsts {
|
CommonConsts {
|
||||||
unit: mk_const(ty::ConstS {
|
unit: mk_const(ty::ConstData {
|
||||||
kind: ty::ConstKind::Value(ty::ValTree::zst()),
|
kind: ty::ConstKind::Value(ty::ValTree::zst()),
|
||||||
ty: types.unit,
|
ty: types.unit,
|
||||||
}),
|
}),
|
||||||
|
@ -1601,7 +1601,7 @@ macro_rules! direct_interners {
|
||||||
|
|
||||||
direct_interners! {
|
direct_interners! {
|
||||||
region: mk_region(RegionKind<'tcx>): Region -> Region<'tcx>,
|
region: mk_region(RegionKind<'tcx>): Region -> Region<'tcx>,
|
||||||
const_: mk_const_internal(ConstS<'tcx>): Const -> Const<'tcx>,
|
const_: mk_const_internal(ConstData<'tcx>): Const -> Const<'tcx>,
|
||||||
const_allocation: intern_const_alloc(Allocation): ConstAllocation -> ConstAllocation<'tcx>,
|
const_allocation: intern_const_alloc(Allocation): ConstAllocation -> ConstAllocation<'tcx>,
|
||||||
layout: intern_layout(LayoutS<VariantIdx>): Layout -> Layout<'tcx>,
|
layout: intern_layout(LayoutS<VariantIdx>): Layout -> Layout<'tcx>,
|
||||||
adt_def: intern_adt_def(AdtDefData): AdtDef -> AdtDef<'tcx>,
|
adt_def: intern_adt_def(AdtDefData): AdtDef -> AdtDef<'tcx>,
|
||||||
|
@ -1976,7 +1976,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn mk_const(self, kind: impl Into<ty::ConstKind<'tcx>>, ty: Ty<'tcx>) -> Const<'tcx> {
|
pub fn mk_const(self, kind: impl Into<ty::ConstKind<'tcx>>, ty: Ty<'tcx>) -> Const<'tcx> {
|
||||||
self.mk_const_internal(ty::ConstS { kind: kind.into(), ty })
|
self.mk_const_internal(ty::ConstData { kind: kind.into(), ty })
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -80,7 +80,7 @@ pub use self::closure::{
|
||||||
CAPTURE_STRUCT_LOCAL,
|
CAPTURE_STRUCT_LOCAL,
|
||||||
};
|
};
|
||||||
pub use self::consts::{
|
pub use self::consts::{
|
||||||
Const, ConstInt, ConstKind, ConstS, Expr, InferConst, ScalarInt, UnevaluatedConst, ValTree,
|
Const, ConstData, ConstInt, ConstKind, Expr, InferConst, ScalarInt, UnevaluatedConst, ValTree,
|
||||||
};
|
};
|
||||||
pub use self::context::{
|
pub use self::context::{
|
||||||
tls, CtxtInterners, DeducedParamAttrs, FreeRegionInfo, GlobalCtxt, Lift, OnDiskCache, TyCtxt,
|
tls, CtxtInterners, DeducedParamAttrs, FreeRegionInfo, GlobalCtxt, Lift, OnDiskCache, TyCtxt,
|
||||||
|
@ -945,7 +945,7 @@ impl<'tcx> Term<'tcx> {
|
||||||
&*((ptr & !TAG_MASK) as *const WithCachedTypeInfo<ty::TyKind<'tcx>>),
|
&*((ptr & !TAG_MASK) as *const WithCachedTypeInfo<ty::TyKind<'tcx>>),
|
||||||
))),
|
))),
|
||||||
CONST_TAG => TermKind::Const(ty::Const(Interned::new_unchecked(
|
CONST_TAG => TermKind::Const(ty::Const(Interned::new_unchecked(
|
||||||
&*((ptr & !TAG_MASK) as *const ty::ConstS<'tcx>),
|
&*((ptr & !TAG_MASK) as *const ty::ConstData<'tcx>),
|
||||||
))),
|
))),
|
||||||
_ => core::intrinsics::unreachable(),
|
_ => core::intrinsics::unreachable(),
|
||||||
}
|
}
|
||||||
|
@ -991,7 +991,7 @@ impl<'tcx> TermKind<'tcx> {
|
||||||
TermKind::Const(ct) => {
|
TermKind::Const(ct) => {
|
||||||
// Ensure we can use the tag bits.
|
// Ensure we can use the tag bits.
|
||||||
assert_eq!(mem::align_of_val(&*ct.0.0) & TAG_MASK, 0);
|
assert_eq!(mem::align_of_val(&*ct.0.0) & TAG_MASK, 0);
|
||||||
(CONST_TAG, ct.0.0 as *const ty::ConstS<'tcx> as usize)
|
(CONST_TAG, ct.0.0 as *const ty::ConstData<'tcx> as usize)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ impl<'tcx> GenericArgKind<'tcx> {
|
||||||
GenericArgKind::Const(ct) => {
|
GenericArgKind::Const(ct) => {
|
||||||
// Ensure we can use the tag bits.
|
// Ensure we can use the tag bits.
|
||||||
assert_eq!(mem::align_of_val(&*ct.0.0) & TAG_MASK, 0);
|
assert_eq!(mem::align_of_val(&*ct.0.0) & TAG_MASK, 0);
|
||||||
(CONST_TAG, ct.0.0 as *const ty::ConstS<'tcx> as usize)
|
(CONST_TAG, ct.0.0 as *const ty::ConstData<'tcx> as usize)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ impl<'tcx> GenericArg<'tcx> {
|
||||||
&*((ptr & !TAG_MASK) as *const WithCachedTypeInfo<ty::TyKind<'tcx>>),
|
&*((ptr & !TAG_MASK) as *const WithCachedTypeInfo<ty::TyKind<'tcx>>),
|
||||||
))),
|
))),
|
||||||
CONST_TAG => GenericArgKind::Const(ty::Const(Interned::new_unchecked(
|
CONST_TAG => GenericArgKind::Const(ty::Const(Interned::new_unchecked(
|
||||||
&*((ptr & !TAG_MASK) as *const ty::ConstS<'tcx>),
|
&*((ptr & !TAG_MASK) as *const ty::ConstData<'tcx>),
|
||||||
))),
|
))),
|
||||||
_ => intrinsics::unreachable(),
|
_ => intrinsics::unreachable(),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue