Should u64 implement From<usize>?

Edit: I've been informed that Rust's usize is uintptr_t, and not size_t. I've assumed the inverse (it has "size" in the name! and bindgen and libc alias size_t to usize), so all my unsafe/FFI code is already broken on 128-bit Rust :frowning:


Here's a presentation about 128-bit RISC-V:

We do NOT want 128 bit flat addressing

The motivation there is in making address space literally global. This is different from handling >64-bit sizes of data. Emphasis mine:

A full 64-bit address space will last for 500 years if allocated at the rate of one gigabyte per second. We believe that 64 bits is enough "for all time" on a single computer, enough for a long time on a small network, and not enough for very long at all on the global network.”

Even 128-bit RISC-V limits byte offsets to 64-bit.

Rust is likely going to need to deal with 128-bit pointers or even 256-bit permission-tagged pointers for the CHERI architecture, but that affects size of uintptr_t, which is different from size_t.

8 Likes