about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-07-20 23:11:23 -0400
committerGitHub <noreply@github.com>2025-07-20 23:11:23 -0400
commit95d9c8dfcb7f330bac83136956894b471cefc702 (patch)
treeaafaa57ca2caadbae6c9fcd54daefcb20f205a83
parentb9701de4b1f49bf7348e800135978c1be54ae22b (diff)
parentd2be1c8d009997584112954b7ee806e07a322eda (diff)
downloadrust-95d9c8dfcb7f330bac83136956894b471cefc702.tar.gz
rust-95d9c8dfcb7f330bac83136956894b471cefc702.zip
Rollup merge of #144230 - RalfJung:option-as-slice-comment-fix, r=scottmcm
Option::as_slice: fix comment

The implementation got changed in https://github.com/rust-lang/rust/pull/117525 without updating the comment. Now the comment makes no sense any more since there is no intrinsic that returns a pointer in this function any more.

(It is also very strange to say "in the new version" in a comment -- what is that supposed to tell someone reading the code 2 years later? That wording was introduced even earlier, in https://github.com/rust-lang/rust/pull/109179.)

Cc `@GKFX` `@petrochenkov` `@llogiq` `@scottmcm`
-rw-r--r--library/core/src/option.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/core/src/option.rs b/library/core/src/option.rs
index 8036c59e893..0e481519f76 100644
--- a/library/core/src/option.rs
+++ b/library/core/src/option.rs
@@ -842,7 +842,7 @@ impl<T> Option<T> {
         // just needs to be aligned, which it is because `&self` is aligned and
         // the offset used is a multiple of alignment.
         //
-        // In the new version, the intrinsic always returns a pointer to an
+        // Here we assume that `offset_of!` always returns an offset to an
         // in-bounds and correctly aligned position for a `T` (even if in the
         // `None` case it's just padding).
         unsafe {