diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-04-30 10:18:25 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-30 10:18:25 +0200 |
| commit | aeec053e1b95b35df3dbd3e064721a55e0d0ac8f (patch) | |
| tree | c7df95f47fb997297fe471df7cdaa663cae6a54f | |
| parent | e89714426b50cdff5fd15c0edb8ab688ce23556d (diff) | |
| parent | 851decdd4f38463239a46031da53911b06da4336 (diff) | |
| download | rust-aeec053e1b95b35df3dbd3e064721a55e0d0ac8f.tar.gz rust-aeec053e1b95b35df3dbd3e064721a55e0d0ac8f.zip | |
Rollup merge of #139192 - lolbinarycat:docs-wrapping_offset-provenance-139008, r=RalfJung
mention provenance in the pointer::wrapping_offset docs fixes https://github.com/rust-lang/rust/issues/139008
| -rw-r--r-- | library/core/src/ptr/const_ptr.rs | 5 | ||||
| -rw-r--r-- | library/core/src/ptr/mut_ptr.rs | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs index bcf34781c8a..5234fb83eb6 100644 --- a/library/core/src/ptr/const_ptr.rs +++ b/library/core/src/ptr/const_ptr.rs @@ -484,8 +484,9 @@ impl<T: ?Sized> *const T { /// /// This operation itself is always safe, but using the resulting pointer is not. /// - /// The resulting pointer "remembers" the [allocated object] that `self` points to; it must not - /// be used to read or write other allocated objects. + /// The resulting pointer "remembers" the [allocated object] that `self` points to + /// (this is called "[Provenance](ptr/index.html#provenance)"). + /// The pointer must not be used to read or write other allocated objects. /// /// In other words, `let z = x.wrapping_offset((y as isize) - (x as isize))` does *not* make `z` /// the same as `y` even if we assume `T` has size `1` and there is no overflow: `z` is still diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs index 6d1a50d8436..31b8d3b572c 100644 --- a/library/core/src/ptr/mut_ptr.rs +++ b/library/core/src/ptr/mut_ptr.rs @@ -482,8 +482,9 @@ impl<T: ?Sized> *mut T { /// /// This operation itself is always safe, but using the resulting pointer is not. /// - /// The resulting pointer "remembers" the [allocated object] that `self` points to; it must not - /// be used to read or write other allocated objects. + /// The resulting pointer "remembers" the [allocated object] that `self` points to + /// (this is called "[Provenance](ptr/index.html#provenance)"). + /// The pointer must not be used to read or write other allocated objects. /// /// In other words, `let z = x.wrapping_offset((y as isize) - (x as isize))` does *not* make `z` /// the same as `y` even if we assume `T` has size `1` and there is no overflow: `z` is still |
