Allow Size to be any valid u64#50916
Conversation
|
LLVM doesn't support allocations or types larger than half the address space (and I am not sure about exactly half the address space). Is there any risk of those coming up after this patch? |
|
We do have tests for these kinds of types. Not sure how to do tests for allocations of such sizes xD |
src/librustc/mir/interpret/mod.rs
Outdated
There was a problem hiding this comment.
I considered that. But i think being explicit is better. I don't feel too strongly about that though, so if you want I'll change it
There was a problem hiding this comment.
I think zero is misleading, I initially assumed it'd be a null pointer.
There was a problem hiding this comment.
Also, random thought: maybe MemoryPointer should be AllocPointer or AbstractPointer?
There was a problem hiding this comment.
We could just name it Pointer and rename the current Pointer struct to PrimvalPointer
There was a problem hiding this comment.
That seems worse. Maybe this?
enum Scalar {
Undef,
Bits(u128),
Ptr(Pointer),
}
enum Value {
Scalar(Scalar),
ScalarPair(Scalar, Scalar),
ByRef(Pointer, Align),
}There was a problem hiding this comment.
What about the current struct Pointer(Primval) type? It's just a wrapper around a PrimVal, but helps us not confuse normal PrimVals with those whose type is a pointer type.
There was a problem hiding this comment.
The type doesn't really matter, the value does (unless there are pointer-specific methods on the wrapper?). And I prefer Scalar over Primval, but I also forgot the latter is really a thing.
|
cc @alexcrichton @nagisa @arielb1 @rkruppe |
|
Hm I don't recall myself, but others might! |
|
@bors r+ |
|
📌 Commit 9f79a19 has been approved by |
Allow `Size` to be any valid `u64` cc rust-lang/miri#378 (comment) The alternative is to make mir::interpret's pointer offsets not be `Size` fixes #50917 r? @eddyb
|
☀️ Test successful - status-appveyor, status-travis |
cc rust-lang/miri#378 (comment)
The alternative is to make mir::interpret's pointer offsets not be
Sizefixes #50917
r? @eddyb