diff options
| author | bors <bors@rust-lang.org> | 2020-08-23 14:50:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-08-23 14:50:15 +0000 |
| commit | 9d606d939a61c2f4c7bb4d89d959b60a53f50241 (patch) | |
| tree | 69c870f2108e2b9a19bc4bfe9e61d81a5105ed05 /src/tools/publish_toolstate.py | |
| parent | b88434ee0f133d220fd86e8bfec7b764a4084bf2 (diff) | |
| parent | 4129e0757a682e5177690ff34df9cc4480257a24 (diff) | |
| download | rust-9d606d939a61c2f4c7bb4d89d959b60a53f50241.tar.gz rust-9d606d939a61c2f4c7bb4d89d959b60a53f50241.zip | |
Auto merge of #74238 - RalfJung:offset_from, r=oli-obk
stabilize ptr_offset_from This stabilizes ptr::offset_from, and closes https://github.com/rust-lang/rust/issues/41079. It also removes the deprecated `wrapping_offset_from`. This function was deprecated 19 days ago and was never stable; given an FCP of 10 days and some waiting time until FCP starts, that leaves at least a month between deprecation and removal which I think is fine for a nightly-only API. Regarding the open questions in https://github.com/rust-lang/rust/issues/41079: * Should offset_from abort instead of panic on ZSTs? -- As far as I know, there is no precedent for such aborts. We could, however, declare this UB. Given that the size is always known statically and the check thus rather cheap, UB seems excessive. * Should there be more methods like this with different restrictions (to allow nuw/nsw, perhaps) or that return usize (like how isize-taking offset is more conveniently done with usize-taking add these days)? -- No reason to block stabilization on that, we can always add such methods later. Also nominating the lang team because this exposes an intrinsic. The stabilized method is best described [by its doc-comment](https://github.com/RalfJung/rust/blob/56d4b2d69abb93e4f0ca79471deca7aaaaeca214/src/libcore/ptr/const_ptr.rs#L227). The documentation forgot to mention the requirement that both pointers must "have the same provenance", aka "be derived from pointers to the same allocation", which I am adding in this PR. This is a precondition that [Miri already implements](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=a3b9d0a07a01321f5202cd99e9613480) and that, should LLVM ever obtain a `psub` operation to subtract pointers, will likely be required for that operation (following the semantics in [this paper](https://people.mpi-sws.org/~jung/twinsem/twinsem.pdf)).
Diffstat (limited to 'src/tools/publish_toolstate.py')
0 files changed, 0 insertions, 0 deletions
