Skip to content

Commit c2f8071

Browse files
committed
Use wide pointers consistenly across the compiler
1 parent f7c8928 commit c2f8071

File tree

36 files changed

+92
-92
lines changed

36 files changed

+92
-92
lines changed

compiler/rustc_codegen_cranelift/example/std_example.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ fn main() {
168168

169169
foo(I64X2([0, 0]));
170170

171-
transmute_fat_pointer();
171+
transmute_wide_pointer();
172172

173173
rust_call_abi();
174174

@@ -192,7 +192,7 @@ type TwoPtrs = i64;
192192
#[cfg(target_pointer_width = "64")]
193193
type TwoPtrs = i128;
194194

195-
fn transmute_fat_pointer() -> TwoPtrs {
195+
fn transmute_wide_pointer() -> TwoPtrs {
196196
unsafe { transmute::<_, TwoPtrs>("true !") }
197197
}
198198

compiler/rustc_codegen_cranelift/src/debuginfo/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ impl DebugContext {
139139

140140
pointer_type_id
141141
} else {
142-
// FIXME implement debuginfo for fat pointers
142+
// FIXME implement debuginfo for wide pointers
143143
self.placeholder_for_type(tcx, type_dbg, ptr_type)
144144
}
145145
}

compiler/rustc_codegen_gcc/src/intrinsic/simd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
478478
let metadata = p_ty.ptr_metadata_ty(bx.tcx, |ty| {
479479
bx.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), ty)
480480
});
481-
require!(metadata.is_unit(), InvalidMonomorphization::CastFatPointer {
481+
require!(metadata.is_unit(), InvalidMonomorphization::CastWidePointer {
482482
span,
483483
name,
484484
ty: in_elem
@@ -493,7 +493,7 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
493493
let metadata = p_ty.ptr_metadata_ty(bx.tcx, |ty| {
494494
bx.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), ty)
495495
});
496-
require!(metadata.is_unit(), InvalidMonomorphization::CastFatPointer {
496+
require!(metadata.is_unit(), InvalidMonomorphization::CastWidePointer {
497497
span,
498498
name,
499499
ty: out_elem

compiler/rustc_codegen_gcc/src/type_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
207207
// layout.
208208
if let Abi::Scalar(ref scalar) = self.abi {
209209
// Use a different cache for scalars because pointers to DSTs
210-
// can be either fat or thin (data pointers of fat pointers).
210+
// can be either fat or thin (data pointers of wide pointers).
211211
if let Some(&ty) = cx.scalar_types.borrow().get(&self.ty) {
212212
return ty;
213213
}

compiler/rustc_codegen_llvm/src/abi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_codegen_ssa::mir::place::{PlaceRef, PlaceValue};
77
use rustc_codegen_ssa::traits::*;
88
use rustc_middle::ty::Ty;
99
use rustc_middle::ty::layout::LayoutOf;
10-
pub(crate) use rustc_middle::ty::layout::{FAT_PTR_ADDR, FAT_PTR_EXTRA};
10+
pub(crate) use rustc_middle::ty::layout::{WIDE_PTR_ADDR, WIDE_PTR_EXTRA};
1111
use rustc_middle::{bug, ty};
1212
use rustc_session::config;
1313
pub(crate) use rustc_target::abi::call::*;

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use super::utils::{
3434
};
3535
use crate::common::CodegenCx;
3636
use crate::debuginfo::metadata::type_map::build_type_with_children;
37-
use crate::debuginfo::utils::{FatPtrKind, fat_pointer_kind};
37+
use crate::debuginfo::utils::{WidePtrKind, wide_pointer_kind};
3838
use crate::llvm::debuginfo::{
3939
DIDescriptor, DIFile, DIFlags, DILexicalBlock, DIScope, DIType, DebugEmissionKind,
4040
DebugNameTableKind,
@@ -174,7 +174,7 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
174174
let data_layout = &cx.tcx.data_layout;
175175
let ptr_type_debuginfo_name = compute_debuginfo_type_name(cx.tcx, ptr_type, true);
176176

177-
match fat_pointer_kind(cx, pointee_type) {
177+
match wide_pointer_kind(cx, pointee_type) {
178178
None => {
179179
// This is a thin pointer. Create a regular pointer type and give it the correct name.
180180
assert_eq!(
@@ -197,7 +197,7 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
197197

198198
DINodeCreationResult { di_node, already_stored_in_typemap: false }
199199
}
200-
Some(fat_pointer_kind) => {
200+
Some(wide_pointer_kind) => {
201201
type_map::build_type_with_children(
202202
cx,
203203
type_map::stub(
@@ -210,7 +210,7 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
210210
DIFlags::FlagZero,
211211
),
212212
|cx, owner| {
213-
// FIXME: If this fat pointer is a `Box` then we don't want to use its
213+
// FIXME: If this wide pointer is a `Box` then we don't want to use its
214214
// type layout and instead use the layout of the raw pointer inside
215215
// of it.
216216
// The proper way to handle this is to not treat Box as a pointer
@@ -227,16 +227,16 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
227227
};
228228

229229
let layout = cx.layout_of(layout_type);
230-
let addr_field = layout.field(cx, abi::FAT_PTR_ADDR);
231-
let extra_field = layout.field(cx, abi::FAT_PTR_EXTRA);
230+
let addr_field = layout.field(cx, abi::WIDE_PTR_ADDR);
231+
let extra_field = layout.field(cx, abi::WIDE_PTR_EXTRA);
232232

233-
let (addr_field_name, extra_field_name) = match fat_pointer_kind {
234-
FatPtrKind::Dyn => ("pointer", "vtable"),
235-
FatPtrKind::Slice => ("data_ptr", "length"),
233+
let (addr_field_name, extra_field_name) = match wide_pointer_kind {
234+
WidePtrKind::Dyn => ("pointer", "vtable"),
235+
WidePtrKind::Slice => ("data_ptr", "length"),
236236
};
237237

238-
assert_eq!(abi::FAT_PTR_ADDR, 0);
239-
assert_eq!(abi::FAT_PTR_EXTRA, 1);
238+
assert_eq!(abi::WIDE_PTR_ADDR, 0);
239+
assert_eq!(abi::WIDE_PTR_EXTRA, 1);
240240

241241
// The data pointer type is a regular, thin pointer, regardless of whether this
242242
// is a slice or a trait object.
@@ -258,7 +258,7 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
258258
owner,
259259
addr_field_name,
260260
(addr_field.size, addr_field.align.abi),
261-
layout.fields.offset(abi::FAT_PTR_ADDR),
261+
layout.fields.offset(abi::WIDE_PTR_ADDR),
262262
DIFlags::FlagZero,
263263
data_ptr_type_di_node,
264264
),
@@ -267,7 +267,7 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
267267
owner,
268268
extra_field_name,
269269
(extra_field.size, extra_field.align.abi),
270-
layout.fields.offset(abi::FAT_PTR_EXTRA),
270+
layout.fields.offset(abi::WIDE_PTR_EXTRA),
271271
DIFlags::FlagZero,
272272
type_di_node(cx, extra_field.ty),
273273
),

compiler/rustc_codegen_llvm/src/debuginfo/utils.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,23 @@ pub(crate) fn get_namespace_for_item<'ll>(cx: &CodegenCx<'ll, '_>, def_id: DefId
4949
}
5050

5151
#[derive(Debug, PartialEq, Eq)]
52-
pub(crate) enum FatPtrKind {
52+
pub(crate) enum WidePtrKind {
5353
Slice,
5454
Dyn,
5555
}
5656

5757
/// Determines if `pointee_ty` is slice-like or trait-object-like, i.e.
58-
/// if the second field of the fat pointer is a length or a vtable-pointer.
59-
/// If `pointee_ty` does not require a fat pointer (because it is Sized) then
58+
/// if the second field of the wide pointer is a length or a vtable-pointer.
59+
/// If `pointee_ty` does not require a wide pointer (because it is Sized) then
6060
/// the function returns `None`.
61-
pub(crate) fn fat_pointer_kind<'ll, 'tcx>(
61+
pub(crate) fn wide_pointer_kind<'ll, 'tcx>(
6262
cx: &CodegenCx<'ll, 'tcx>,
6363
pointee_ty: Ty<'tcx>,
64-
) -> Option<FatPtrKind> {
64+
) -> Option<WidePtrKind> {
6565
let pointee_tail_ty = cx.tcx.struct_tail_for_codegen(pointee_ty, cx.param_env());
6666
let layout = cx.layout_of(pointee_tail_ty);
6767
trace!(
68-
"fat_pointer_kind: {:?} has layout {:?} (is_unsized? {})",
68+
"wide_pointer_kind: {:?} has layout {:?} (is_unsized? {})",
6969
pointee_tail_ty,
7070
layout,
7171
layout.is_unsized()
@@ -76,8 +76,8 @@ pub(crate) fn fat_pointer_kind<'ll, 'tcx>(
7676
}
7777

7878
match *pointee_tail_ty.kind() {
79-
ty::Str | ty::Slice(_) => Some(FatPtrKind::Slice),
80-
ty::Dynamic(..) => Some(FatPtrKind::Dyn),
79+
ty::Str | ty::Slice(_) => Some(WidePtrKind::Slice),
80+
ty::Dynamic(..) => Some(WidePtrKind::Dyn),
8181
ty::Foreign(_) => {
8282
// Assert that pointers to foreign types really are thin:
8383
assert_eq!(
@@ -90,7 +90,7 @@ pub(crate) fn fat_pointer_kind<'ll, 'tcx>(
9090
// For all other pointee types we should already have returned None
9191
// at the beginning of the function.
9292
panic!(
93-
"fat_pointer_kind() - Encountered unexpected `pointee_tail_ty`: {pointee_tail_ty:?}"
93+
"wide_pointer_kind() - Encountered unexpected `pointee_tail_ty`: {pointee_tail_ty:?}"
9494
)
9595
}
9696
}

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,7 +2185,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
21852185
let metadata = p_ty.ptr_metadata_ty(bx.tcx, |ty| {
21862186
bx.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), ty)
21872187
});
2188-
require!(metadata.is_unit(), InvalidMonomorphization::CastFatPointer {
2188+
require!(metadata.is_unit(), InvalidMonomorphization::CastWidePointer {
21892189
span,
21902190
name,
21912191
ty: in_elem
@@ -2200,7 +2200,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
22002200
let metadata = p_ty.ptr_metadata_ty(bx.tcx, |ty| {
22012201
bx.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), ty)
22022202
});
2203-
require!(metadata.is_unit(), InvalidMonomorphization::CastFatPointer {
2203+
require!(metadata.is_unit(), InvalidMonomorphization::CastWidePointer {
22042204
span,
22052205
name,
22062206
ty: out_elem

compiler/rustc_codegen_llvm/src/type_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> {
199199
// layout.
200200
if let Abi::Scalar(scalar) = self.abi {
201201
// Use a different cache for scalars because pointers to DSTs
202-
// can be either fat or thin (data pointers of fat pointers).
202+
// can be either fat or thin (data pointers of wide pointers).
203203
if let Some(&llty) = cx.scalar_lltypes.borrow().get(&self.ty) {
204204
return llty;
205205
}

compiler/rustc_codegen_ssa/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ codegen_ssa_invalid_monomorphization_basic_integer_type = invalid monomorphizati
8282
8383
codegen_ssa_invalid_monomorphization_cannot_return = invalid monomorphization of `{$name}` intrinsic: cannot return `{$ret_ty}`, expected `u{$expected_int_bits}` or `[u8; {$expected_bytes}]`
8484
85-
codegen_ssa_invalid_monomorphization_cast_fat_pointer = invalid monomorphization of `{$name}` intrinsic: cannot cast fat pointer `{$ty}`
85+
codegen_ssa_invalid_monomorphization_cast_wide_pointer = invalid monomorphization of `{$name}` intrinsic: cannot cast wide pointer `{$ty}`
8686
8787
codegen_ssa_invalid_monomorphization_expected_element_type = invalid monomorphization of `{$name}` intrinsic: expected element type `{$expected_element}` of second argument `{$second_arg}` to be a pointer to the element type `{$in_elem}` of the first argument `{$in_ty}`, found `{$expected_element}` != `{$mutability} {$in_elem}`
8888

0 commit comments

Comments
 (0)