rust/src/librustdoc
bors 9d606d939a 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](56d4b2d69a/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)).
2020-08-23 14:50:15 +00:00
..
clean xpy fmt 2020-08-19 08:26:31 -04:00
formats More requested changes 2020-07-27 17:34:17 -05:00
html Rollup merge of #75665 - GuillaumeGomez:doc-examples-coverage, r=jyn514 2020-08-19 15:54:37 +09:00
json Update driver to add json backend 2020-07-30 14:13:51 -05:00
passes Auto merge of #75776 - GuillaumeGomez:missing-doc-examples-lint-improvements, r=jyn514 2020-08-22 06:51:13 +00:00
test Normalize syntax::edition imports. 2020-01-02 19:31:38 +01:00
theme Add test to check if minified theme are handled correctly 2020-02-12 15:49:39 +01:00
Cargo.toml Return all impls, not just the primary one 2020-08-19 08:18:24 -04:00
config.rs Update driver to add json backend 2020-07-30 14:13:51 -05:00
core.rs Lazy decoding of DefPathTable from crate metadata (non-incremental case) 2020-08-22 21:19:47 +03:00
docfs.rs fix clippy::unit_arg: make it explicit that Ok(()) is being returned 2020-08-07 22:47:32 +02:00
doctree.rs rust_ast::ast => rustc_ast 2020-08-17 20:32:32 +00:00
error.rs Move Error and RenderInfo out of html module 2020-07-27 16:00:38 -05:00
externalfiles.rs rustdoc: Rename internal API fns to into_string 2020-07-15 10:55:40 +00:00
fold.rs Format the world 2019-12-22 17:42:47 -05:00
lib.rs stabilize ptr_offset_from 2020-08-22 14:37:10 +02:00
markdown.rs rustdoc: Rename internal API fns to into_string 2020-07-15 10:55:40 +00:00
README.md rust-lang.github.io/rustc-dev-guide -> rustc-dev-guide.rust-lang.org 2020-03-10 17:08:18 -03:00
test.rs rust_ast::ast => rustc_ast 2020-08-17 20:32:32 +00:00
theme.rs Expand and remove try_something macro. 2020-04-02 19:55:56 +02:00
visit_ast.rs rust_ast::ast => rustc_ast 2020-08-17 20:32:32 +00:00
visit_lib.rs rustc -> rustc_middle part 3 (rustfmt) 2020-03-30 07:19:55 +02:00

For more information about how librustdoc works, see the rustc dev guide.