rust-lang / nomicon

The Dark Arts of Advanced and Unsafe Rust Programming
https://doc.rust-lang.org/nomicon/
Apache License 2.0
1.75k stars 256 forks source link

NonNull::dangling uses `align_of<T>`, not `size_of<T>` #374

Closed 5225225 closed 1 year ago

5225225 commented 1 year ago

This reverts #371.

Because NonNull::dangling() does not use the size of T, otherwise it would have no way to make a pointer to a ZST.

Gankra commented 1 year ago

thanks