Skip to content

Conversation

@AudaciousAxiom
Copy link

Following the discussion in rust-lang/rust#147960, this adds an explicit guarantee that isize is represented with two's complement.

This is not intended as a new guarantee, but only as stating what is already mentioned in other places of the reference in the same place as it is for fixed-width integer types:

Remember that signed integers are always represented using two's complement.

r? @traviscross

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Oct 25, 2025
r[type.numeric.int.size.isize]
The `isize` type is a signed integer type with the same number of bits as the
The `isize` type is a signed two's complement integer type with the same number of bits as the
Copy link
Author

Choose a reason for hiding this comment

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

I didn't reflow the paragraph as the policy seems to be to not wrap long lines anymore (which I prefer anyway).

@tmandry
Copy link
Member

tmandry commented Oct 29, 2025

Since we guarantee this for fixed-width signed integers already, it seems clear that we should guarantee it for isize as well.

@rfcbot fcp merge

@rust-rfcbot
Copy link
Collaborator

rust-rfcbot commented Oct 29, 2025

Team member @tmandry has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@traviscross
Copy link
Contributor

@rfcbot reviewed

@traviscross traviscross changed the title feat: guarantee the binary representation of isize explicitly Guarantee the binary representation of isize explicitly Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge I-lang-nominated P-lang-drag-1 Lang team prioritization drag level 1. proposed-final-comment-period S-waiting-on-review Status: The marked PR is awaiting review from a maintainer T-lang Team: Lang

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants