Skip to content

Commit 49c2279

Browse files
committed
Auto merge of rust-lang#105820 - matthiaskrgr:rollup-uzm1l8f, r=matthiaskrgr
Rollup of 2 pull requests Successful merges: - rust-lang#105770 (Rename ConstS to ConstData) - rust-lang#105785 (Add regression test for rust-lang#55976) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents fde3000 + 905caed commit 49c2279

File tree

7 files changed

+29
-16
lines changed

7 files changed

+29
-16
lines changed

compiler/rustc_middle/src/arena.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ macro_rules! arena_types {
9393
// Interned types
9494
[] tys: rustc_type_ir::WithCachedTypeInfo<rustc_middle::ty::TyKind<'tcx>>,
9595
[] predicates: rustc_type_ir::WithCachedTypeInfo<rustc_middle::ty::PredicateKind<'tcx>>,
96-
[] consts: rustc_middle::ty::ConstS<'tcx>,
96+
[] consts: rustc_middle::ty::ConstData<'tcx>,
9797

9898
// Note that this deliberately duplicates items in the `rustc_hir::arena`,
9999
// since we need to allocate this type on both the `rustc_hir` arena

compiler/rustc_middle/src/ty/codec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> RefDecodable<'tcx, D>
310310

311311
impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> Decodable<D> for ty::Const<'tcx> {
312312
fn decode(decoder: &mut D) -> Self {
313-
let consts: ty::ConstS<'tcx> = Decodable::decode(decoder);
313+
let consts: ty::ConstData<'tcx> = Decodable::decode(decoder);
314314
decoder.interner().mk_const(consts.kind, consts.ty)
315315
}
316316
}

compiler/rustc_middle/src/ty/consts.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ pub use int::*;
1414
pub use kind::*;
1515
pub use valtree::*;
1616

17-
/// Use this rather than `ConstS`, whenever possible.
17+
/// Use this rather than `ConstData, whenever possible.
1818
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, HashStable)]
1919
#[rustc_pass_by_value]
20-
pub struct Const<'tcx>(pub Interned<'tcx, ConstS<'tcx>>);
20+
pub struct Const<'tcx>(pub(super) Interned<'tcx, ConstData<'tcx>>);
2121

2222
impl<'tcx> fmt::Debug for Const<'tcx> {
2323
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -30,13 +30,13 @@ impl<'tcx> fmt::Debug for Const<'tcx> {
3030

3131
/// Typed constant value.
3232
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, HashStable, TyEncodable, TyDecodable)]
33-
pub struct ConstS<'tcx> {
33+
pub struct ConstData<'tcx> {
3434
pub ty: Ty<'tcx>,
3535
pub kind: ConstKind<'tcx>,
3636
}
3737

3838
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
39-
static_assert_size!(ConstS<'_>, 40);
39+
static_assert_size!(ConstData<'_>, 40);
4040

4141
impl<'tcx> Const<'tcx> {
4242
#[inline]

compiler/rustc_middle/src/ty/context.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::thir::Thir;
1717
use crate::traits;
1818
use crate::ty::query::{self, TyCtxtAt};
1919
use crate::ty::{
20-
self, AdtDef, AdtDefData, AdtKind, Binder, Const, ConstS, DefIdTree, FloatTy, FloatVar,
20+
self, AdtDef, AdtDefData, AdtKind, Binder, Const, ConstData, DefIdTree, FloatTy, FloatVar,
2121
FloatVid, GenericParamDefKind, ImplPolarity, InferTy, IntTy, IntVar, IntVid, List, ParamConst,
2222
ParamTy, PolyExistentialPredicate, PolyFnSig, Predicate, PredicateKind, Region, RegionKind,
2323
ReprOptions, TraitObjectVisitor, Ty, TyKind, TyVar, TyVid, TypeAndMut, TypeckResults, UintTy,
@@ -140,7 +140,7 @@ pub struct CtxtInterners<'tcx> {
140140
predicates: InternedSet<'tcx, List<Predicate<'tcx>>>,
141141
projs: InternedSet<'tcx, List<ProjectionKind>>,
142142
place_elems: InternedSet<'tcx, List<PlaceElem<'tcx>>>,
143-
const_: InternedSet<'tcx, ConstS<'tcx>>,
143+
const_: InternedSet<'tcx, ConstData<'tcx>>,
144144
const_allocation: InternedSet<'tcx, Allocation>,
145145
bound_variable_kinds: InternedSet<'tcx, List<ty::BoundVariableKind>>,
146146
layout: InternedSet<'tcx, LayoutS<VariantIdx>>,
@@ -331,7 +331,7 @@ impl<'tcx> CommonConsts<'tcx> {
331331
};
332332

333333
CommonConsts {
334-
unit: mk_const(ty::ConstS {
334+
unit: mk_const(ty::ConstData {
335335
kind: ty::ConstKind::Value(ty::ValTree::zst()),
336336
ty: types.unit,
337337
}),
@@ -1601,7 +1601,7 @@ macro_rules! direct_interners {
16011601

16021602
direct_interners! {
16031603
region: mk_region(RegionKind<'tcx>): Region -> Region<'tcx>,
1604-
const_: mk_const_internal(ConstS<'tcx>): Const -> Const<'tcx>,
1604+
const_: mk_const_internal(ConstData<'tcx>): Const -> Const<'tcx>,
16051605
const_allocation: intern_const_alloc(Allocation): ConstAllocation -> ConstAllocation<'tcx>,
16061606
layout: intern_layout(LayoutS<VariantIdx>): Layout -> Layout<'tcx>,
16071607
adt_def: intern_adt_def(AdtDefData): AdtDef -> AdtDef<'tcx>,
@@ -1976,7 +1976,7 @@ impl<'tcx> TyCtxt<'tcx> {
19761976

19771977
#[inline]
19781978
pub fn mk_const(self, kind: impl Into<ty::ConstKind<'tcx>>, ty: Ty<'tcx>) -> Const<'tcx> {
1979-
self.mk_const_internal(ty::ConstS { kind: kind.into(), ty })
1979+
self.mk_const_internal(ty::ConstData { kind: kind.into(), ty })
19801980
}
19811981

19821982
#[inline]

compiler/rustc_middle/src/ty/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub use self::closure::{
8080
CAPTURE_STRUCT_LOCAL,
8181
};
8282
pub use self::consts::{
83-
Const, ConstInt, ConstKind, ConstS, Expr, InferConst, ScalarInt, UnevaluatedConst, ValTree,
83+
Const, ConstData, ConstInt, ConstKind, Expr, InferConst, ScalarInt, UnevaluatedConst, ValTree,
8484
};
8585
pub use self::context::{
8686
tls, CtxtInterners, DeducedParamAttrs, FreeRegionInfo, GlobalCtxt, Lift, OnDiskCache, TyCtxt,
@@ -945,7 +945,7 @@ impl<'tcx> Term<'tcx> {
945945
&*((ptr & !TAG_MASK) as *const WithCachedTypeInfo<ty::TyKind<'tcx>>),
946946
))),
947947
CONST_TAG => TermKind::Const(ty::Const(Interned::new_unchecked(
948-
&*((ptr & !TAG_MASK) as *const ty::ConstS<'tcx>),
948+
&*((ptr & !TAG_MASK) as *const ty::ConstData<'tcx>),
949949
))),
950950
_ => core::intrinsics::unreachable(),
951951
}
@@ -991,7 +991,7 @@ impl<'tcx> TermKind<'tcx> {
991991
TermKind::Const(ct) => {
992992
// Ensure we can use the tag bits.
993993
assert_eq!(mem::align_of_val(&*ct.0.0) & TAG_MASK, 0);
994-
(CONST_TAG, ct.0.0 as *const ty::ConstS<'tcx> as usize)
994+
(CONST_TAG, ct.0.0 as *const ty::ConstData<'tcx> as usize)
995995
}
996996
};
997997

compiler/rustc_middle/src/ty/subst.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl<'tcx> GenericArgKind<'tcx> {
9090
GenericArgKind::Const(ct) => {
9191
// Ensure we can use the tag bits.
9292
assert_eq!(mem::align_of_val(&*ct.0.0) & TAG_MASK, 0);
93-
(CONST_TAG, ct.0.0 as *const ty::ConstS<'tcx> as usize)
93+
(CONST_TAG, ct.0.0 as *const ty::ConstData<'tcx> as usize)
9494
}
9595
};
9696

@@ -166,7 +166,7 @@ impl<'tcx> GenericArg<'tcx> {
166166
&*((ptr & !TAG_MASK) as *const WithCachedTypeInfo<ty::TyKind<'tcx>>),
167167
))),
168168
CONST_TAG => GenericArgKind::Const(ty::Const(Interned::new_unchecked(
169-
&*((ptr & !TAG_MASK) as *const ty::ConstS<'tcx>),
169+
&*((ptr & !TAG_MASK) as *const ty::ConstData<'tcx>),
170170
))),
171171
_ => intrinsics::unreachable(),
172172
}

src/test/ui/codegen/issue-55976.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// run-pass
2+
// ^-- The above is needed as this issue is related to LLVM/codegen.
3+
// min-llvm-version:15.0.0
4+
// ^-- The above is needed as this issue is fixed by the opaque pointers.
5+
6+
fn main() {
7+
type_error(|x| &x);
8+
}
9+
10+
fn type_error<T>(
11+
_selector: for<'a> fn(&'a Vec<Box<dyn for<'b> Fn(&'b u8)>>) -> &'a Vec<Box<dyn Fn(T)>>,
12+
) {
13+
}

0 commit comments

Comments
 (0)