1
Fork 0

Rollup merge of #132252 - workingjubilee:rename-layouts-to-layoutdata, r=jieyouxu

compiler: rename LayoutS to LayoutData

Bid `LayoutS` goodbye because it looks like a typo.

`LayoutS` is the last of the types that use the "`{TypeName}` is the interned type, `{TypeName}S` is the backing data that is interned" convention. This is pretty confusing to those not intimately familiar with the history of rustc's names for its types over time, and doubly so now that there are no other examples in the tree. Abolish this convention.
This commit is contained in:
Matthias Krüger 2024-10-28 12:14:59 +01:00 committed by GitHub
commit a4acbd561b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 60 additions and 60 deletions

View file

@ -8,7 +8,7 @@
macro_rules! arena_types {
($macro:path) => (
$macro!([
[] layout: rustc_target::abi::LayoutS<rustc_target::abi::FieldIdx, rustc_target::abi::VariantIdx>,
[] layout: rustc_abi::LayoutData<rustc_abi::FieldIdx, rustc_abi::VariantIdx>,
[] fn_abi: rustc_target::abi::call::FnAbi<'tcx, rustc_middle::ty::Ty<'tcx>>,
// AdtDef are interned and compared by address
[decode] adt_def: rustc_middle::ty::AdtDefData,

View file

@ -12,7 +12,7 @@ use std::marker::PhantomData;
use std::ops::{Bound, Deref};
use std::{fmt, iter, mem};
use rustc_abi::{FieldIdx, Layout, LayoutS, TargetDataLayout, VariantIdx};
use rustc_abi::{FieldIdx, Layout, LayoutData, TargetDataLayout, VariantIdx};
use rustc_ast::{self as ast, attr};
use rustc_data_structures::defer;
use rustc_data_structures::fingerprint::Fingerprint;
@ -766,7 +766,7 @@ pub struct CtxtInterners<'tcx> {
pat: InternedSet<'tcx, PatternKind<'tcx>>,
const_allocation: InternedSet<'tcx, Allocation>,
bound_variable_kinds: InternedSet<'tcx, List<ty::BoundVariableKind>>,
layout: InternedSet<'tcx, LayoutS<FieldIdx, VariantIdx>>,
layout: InternedSet<'tcx, LayoutData<FieldIdx, VariantIdx>>,
adt_def: InternedSet<'tcx, AdtDefData>,
external_constraints: InternedSet<'tcx, ExternalConstraintsData<TyCtxt<'tcx>>>,
predefined_opaques_in_body: InternedSet<'tcx, PredefinedOpaquesData<TyCtxt<'tcx>>>,
@ -2469,7 +2469,7 @@ direct_interners! {
region: pub(crate) intern_region(RegionKind<'tcx>): Region -> Region<'tcx>,
pat: pub mk_pat(PatternKind<'tcx>): Pattern -> Pattern<'tcx>,
const_allocation: pub mk_const_alloc(Allocation): ConstAllocation -> ConstAllocation<'tcx>,
layout: pub mk_layout(LayoutS<FieldIdx, VariantIdx>): Layout -> Layout<'tcx>,
layout: pub mk_layout(LayoutData<FieldIdx, VariantIdx>): Layout -> Layout<'tcx>,
adt_def: pub mk_adt_def_from_data(AdtDefData): AdtDef -> AdtDef<'tcx>,
external_constraints: pub mk_external_constraints(ExternalConstraintsData<TyCtxt<'tcx>>):
ExternalConstraints -> ExternalConstraints<'tcx>,

View file

@ -4,7 +4,7 @@ use std::{cmp, fmt};
use rustc_abi::Primitive::{self, Float, Int, Pointer};
use rustc_abi::{
Abi, AddressSpace, Align, FieldsShape, HasDataLayout, Integer, LayoutCalculator, LayoutS,
Abi, AddressSpace, Align, FieldsShape, HasDataLayout, Integer, LayoutCalculator, LayoutData,
PointeeInfo, PointerKind, ReprOptions, Scalar, Size, TagEncoding, TargetDataLayout, Variants,
};
use rustc_error_messages::DiagMessage;
@ -751,7 +751,7 @@ where
ty::Adt(def, _) => def.variant(variant_index).fields.len(),
_ => bug!("`ty_and_layout_for_variant` on unexpected type {}", this.ty),
};
tcx.mk_layout(LayoutS {
tcx.mk_layout(LayoutData {
variants: Variants::Single { index: variant_index },
fields: match NonZero::new(fields) {
Some(fields) => FieldsShape::Union(fields),
@ -788,7 +788,7 @@ where
let tcx = cx.tcx();
let tag_layout = |tag: Scalar| -> TyAndLayout<'tcx> {
TyAndLayout {
layout: tcx.mk_layout(LayoutS::scalar(cx, tag)),
layout: tcx.mk_layout(LayoutData::scalar(cx, tag)),
ty: tag.primitive().to_ty(tcx),
}
};