Skip to content

Commit 2de4f21

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

File tree

35 files changed

+74
-74
lines changed

35 files changed

+74
-74
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/debuginfo/metadata.rs

Lines changed: 5 additions & 5 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::{FatPtrKind, 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
@@ -230,7 +230,7 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
230230
let addr_field = layout.field(cx, abi::FAT_PTR_ADDR);
231231
let extra_field = layout.field(cx, abi::FAT_PTR_EXTRA);
232232

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

compiler/rustc_codegen_llvm/src/debuginfo/utils.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ pub(crate) enum FatPtrKind {
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>,
6464
) -> Option<FatPtrKind> {
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()
@@ -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

compiler/rustc_codegen_ssa/src/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,8 @@ pub enum InvalidMonomorphization<'tcx> {
916916
ret_ty: Ty<'tcx>,
917917
},
918918

919-
#[diag(codegen_ssa_invalid_monomorphization_cast_fat_pointer, code = E0511)]
920-
CastFatPointer {
919+
#[diag(codegen_ssa_invalid_monomorphization_cast_wide_pointer, code = E0511)]
920+
CastWidePointer {
921921
#[primary_span]
922922
span: Span,
923923
name: Symbol,

0 commit comments

Comments
 (0)