consistently treat None-tagged pointers as ints; get rid of some deprecated Scalar methods
This commit is contained in:
parent
d4f7dd6702
commit
626605cea0
29 changed files with 145 additions and 139 deletions
|
@ -38,7 +38,7 @@ crate fn lit_to_const<'tcx>(
|
|||
}
|
||||
(ast::LitKind::ByteStr(data), ty::Ref(_, inner_ty, _)) if inner_ty.is_array() => {
|
||||
let id = tcx.allocate_bytes(data);
|
||||
ConstValue::Scalar(Scalar::Ptr(id.into()))
|
||||
ConstValue::Scalar(Scalar::from_pointer(id.into(), &tcx))
|
||||
}
|
||||
(ast::LitKind::Byte(n), ty::Uint(ty::UintTy::U8)) => {
|
||||
ConstValue::Scalar(Scalar::from_uint(*n, Size::from_bytes(1)))
|
||||
|
|
|
@ -928,7 +928,11 @@ impl<'tcx> Cx<'tcx> {
|
|||
} else {
|
||||
let ptr = self.tcx.create_static_alloc(id);
|
||||
ExprKind::StaticRef {
|
||||
literal: ty::Const::from_scalar(self.tcx, Scalar::Ptr(ptr.into()), ty),
|
||||
literal: ty::Const::from_scalar(
|
||||
self.tcx,
|
||||
Scalar::from_pointer(ptr.into(), &self.tcx),
|
||||
ty,
|
||||
),
|
||||
def_id: id,
|
||||
}
|
||||
};
|
||||
|
|
|
@ -123,7 +123,7 @@ impl IntRange {
|
|||
// straight to the result, after doing a bit of checking. (We
|
||||
// could remove this branch and just fall through, which
|
||||
// is more general but much slower.)
|
||||
if let Ok(bits) = scalar.to_bits_or_ptr(target_size, &tcx) {
|
||||
if let Ok(bits) = scalar.to_bits_or_ptr(target_size) {
|
||||
return Some(bits);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue