Skip to content

Restrict PartialEq and PartialOrd documentation to thin pointers - #163372

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
niluxv:ptr-cmp-docs1
Oct 24, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
niluxv:ptr-cmp-docs1

Conversation

@niluxv

@niluxv niluxv commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

For fat pointers, the old documentation that the comparison reduces to comparison of the addresses is clearly wrong. Don't make any new guarantees for now by simply restricting the documentation to thin pointers.

(Found this issue while writing up #163013.)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 26, 2026
@rustbot

rustbot commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

r? @JohnTitor

rustbot has assigned @JohnTitor.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: libs
  • libs expanded to 12 candidates
  • Random selection from 6 candidates

Comment thread library/core/src/ptr/const_ptr.rs Resolved
Comment thread library/core/src/ptr/mut_ptr.rs Resolved
Comment thread library/core/src/ptr/const_ptr.rs Resolved
For fat pointers, the old documentation that the comparison reduces to
comparison of the addresses is clearly wrong. Don't make any new guarantees
for now by simply restricting the documentation to thin pointers.
@ChrisDenton

ChrisDenton commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

r? ChrisDenton

Thanks! Do we have a definition of thin pointers we can link to? I worry this will look like jargon on its own.

@rustbot rustbot assigned ChrisDenton and unassigned JohnTitor Oct 23, 2026
@niluxv

niluxv commented Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Hm, apparently not. During a quick search I could only find mention of thin pointers in unstable items. I did find one mention of fat pointers on std::ptr::addr_eq though (which are also called wide-pointers in different parts of the API documentation):

Compares the addresses of the two pointers for equality, ignoring any metadata in fat pointers.

But other than that the documentation of stable items seems to mostly ignore the existence of fat/wide pointers.

@ChrisDenton ChrisDenton left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I'm going to accept this as I think it is an improvement and "thin pointer" is a common enough term in rust.

We really should define our terms properly though. Would you be willing to open an issue about the lack of thin pointer definition (and maybe the fat/wide terminology inconsistency)?

View changes since this review

@ChrisDenton

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 46ad236 has been approved by ChrisDenton

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 23, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 23, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #163743 (std: simplify the miri bypass of the stack overflow detection logic)
 - #164474 (core: implement `char::is_xid_{start|continue}`)
 - #164643 (Const-stabilize `{BinaryHeap, BTreeMap, BTreeSet, LinkedList, VecDeque)::{len, is_empty}`)
 - #164739 (Use cfi_encoding instead of name in abi checking in miri)
 - #162927 (stabilize ptr_cast_slice)
 - #163372 (Restrict `PartialEq` and `PartialOrd` documentation to thin pointers)
 - #164261 (Simplify MSYS check in is_terminal on Windows)
 - #164698 (Remove FCP from libs tracking checklist)
 - #164810 (Don't prioritize issues that require internal features)
@rust-bors
rust-bors Bot merged commit 89441e8 into rust-lang:main Oct 24, 2026
13 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 24, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 24, 2026
Rollup merge of #163372 - niluxv:ptr-cmp-docs1, r=ChrisDenton

Restrict `PartialEq` and `PartialOrd` documentation to thin pointers

For fat pointers, the old documentation that the comparison reduces to comparison of the addresses is clearly wrong. Don't make any new guarantees for now by simply restricting the documentation to thin pointers.

(Found this issue while writing up #163013.)
programskillforverification pushed a commit to programskillforverification/miri that referenced this pull request Oct 24, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#163743 (std: simplify the miri bypass of the stack overflow detection logic)
 - rust-lang/rust#164474 (core: implement `char::is_xid_{start|continue}`)
 - rust-lang/rust#164643 (Const-stabilize `{BinaryHeap, BTreeMap, BTreeSet, LinkedList, VecDeque)::{len, is_empty}`)
 - rust-lang/rust#164739 (Use cfi_encoding instead of name in abi checking in miri)
 - rust-lang/rust#162927 (stabilize ptr_cast_slice)
 - rust-lang/rust#163372 (Restrict `PartialEq` and `PartialOrd` documentation to thin pointers)
 - rust-lang/rust#164261 (Simplify MSYS check in is_terminal on Windows)
 - rust-lang/rust#164698 (Remove FCP from libs tracking checklist)
 - rust-lang/rust#164810 (Don't prioritize issues that require internal features)
@clarfonthey clarfonthey added the A-raw-pointers Area: raw pointers, MaybeUninit, NonNull label Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-raw-pointers Area: raw pointers, MaybeUninit, NonNull S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants