Skip to content

Commit a7888a7

Browse files
committed
Comment updates
1 parent d483764 commit a7888a7

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

compiler/rustc_codegen_gcc/src/common.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ impl<'gcc, 'tcx> ConstCodegenMethods for CodegenCx<'gcc, 'tcx> {
283283
}
284284
GlobalAlloc::TypeId { .. } => {
285285
let val = self.const_usize(offset.bytes());
286+
// This is still a variable of pointer type, even though we only use the provenance
287+
// of that pointer in CTFE and Miri. But to make LLVM's type system happy,
288+
// we need an int-to-ptr cast here (it doesn't matter at all which provenance that picks).
286289
return self.context.new_cast(None, val, ty);
287290
}
288291
GlobalAlloc::Static(def_id) => {

compiler/rustc_const_eval/src/interpret/intrinsics.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,12 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
9393
self.write_type_id(tp_ty, dest)?;
9494
}
9595
sym::type_id_eq => {
96+
// Both operands are `TypeId`, which is a newtype around an array of pointers.
97+
// Project until we have the array elements.
9698
let a_fields = self.project_field(&args[0], FieldIdx::ZERO)?;
9799
let b_fields = self.project_field(&args[1], FieldIdx::ZERO)?;
98100

99101
let mut a_fields = self.project_array_fields(&a_fields)?;
100-
101102
let mut b_fields = self.project_array_fields(&b_fields)?;
102103

103104
let (_idx, a) = a_fields

0 commit comments

Comments
 (0)