Skip to content

Commit d5a590f

Browse files
RalfJungoli-obk
andcommitted
comment
Co-authored-by: Oli Scherer <[email protected]>
1 parent fafccdc commit d5a590f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

compiler/rustc_codegen_ssa/src/mir/rvalue.rs

+3
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
270270
PointerCast::MutToConstPointer | PointerCast::ArrayToPointer,
271271
)
272272
| mir::CastKind::Misc
273+
// Since int2ptr can have arbitrary integer types as input (so we have to do
274+
// sign extension and all that), it is currently best handled in the same code
275+
// path as the other integer-to-X casts.
273276
| mir::CastKind::PointerFromExposedAddress => {
274277
assert!(bx.cx().is_backend_immediate(cast));
275278
let ll_t_out = bx.cx().immediate_backend_type(cast);

compiler/rustc_const_eval/src/transform/promote_consts.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ impl<'tcx> Validator<'_, 'tcx> {
504504
// ptr-to-int casts are not possible in consts and thus not promotable
505505
Rvalue::Cast(CastKind::PointerExposeAddress, _, _) => return Err(Unpromotable),
506506

507-
// all ohter casts including int-to-ptr casts are fine, they just use the integer value
507+
// all other casts including int-to-ptr casts are fine, they just use the integer value
508508
// at pointer type.
509509
Rvalue::Cast(_, operand, _) => {
510510
self.validate_operand(operand)?;

0 commit comments

Comments
 (0)