Our offset/wrapping_offset docs talk about staying within the same "allocated object". That seems to confuse some people because "variables on the stack are not created by the allocator". Is there another term we could use? We want to include both stack- and heap-allocated variables.
Maybe we just have to be a bit more explicit, like "the same (stack- or heap-)allocated object"
I doubt there's any way to stop that misconception just by picking terminology cleverly, "stack and heap are radically different" is a widespread meme. How about explicitly saying something like: every variable "on the stack" is a separate allocation for this purpose
that sounds like a good idea
every variable "on the stack" is a separate allocation for this purpose
In the abstract machine, every variable on the stack is a separate allocation, right?
The stack and the heap aren't different here.
The whole point of this thread is that while they really aren't different for the abstract machine, this isn't clear to everyone.
I'd just leave out the "for this purpose" out from the note.
"Recall that every variable on the stack is a separate allocation in the abstract machine" might be enough
I don't expect everyone to know what "the abstract machine" is or what the implications of this clause are. I proposed adding "for this purpose" to dissuade e.g. arguments that "the entire stack is really just one big allocation in the kernel" by reminding people of the context (Rust-level UB), but I'm not overly attached to it.
Maybe we can just say "Recall that in Rust every variable on the stack is a separate allocation" to avoid using the term abstract machine.
the entire stack is really just one big allocation in the kernel
This already has a trivial counter-example in WASM
submitted a PR at https://github.com/rust-lang/rust/pull/63297
having to edit this in like 6 different places is so annoying :/