Auto merge of #85376 - RalfJung:ptrless-allocs, r=oli-obk
CTFE core engine allocation & memory API improvemenets This is a first step towards https://github.com/rust-lang/miri/issues/841. - make `Allocation` API offset-based (no more making up `Pointer`s just to access an `Allocation`) - make `Memory` API higher-level (combine checking for access and getting access into one operation) The Miri-side PR is at https://github.com/rust-lang/miri/pull/1804. r? `@oli-obk`
This commit is contained in:
commit
3e827cc21e
19 changed files with 599 additions and 512 deletions
|
@ -441,6 +441,8 @@ pub struct Align {
|
|||
}
|
||||
|
||||
impl Align {
|
||||
pub const ONE: Align = Align { pow2: 0 };
|
||||
|
||||
#[inline]
|
||||
pub fn from_bits(bits: u64) -> Result<Align, String> {
|
||||
Align::from_bytes(Size::from_bits(bits).bytes())
|
||||
|
@ -450,7 +452,7 @@ impl Align {
|
|||
pub fn from_bytes(align: u64) -> Result<Align, String> {
|
||||
// Treat an alignment of 0 bytes like 1-byte alignment.
|
||||
if align == 0 {
|
||||
return Ok(Align { pow2: 0 });
|
||||
return Ok(Align::ONE);
|
||||
}
|
||||
|
||||
#[cold]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue