Skip to content

Conversation

@AudaciousAxiom
Copy link
Contributor

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
Contributor 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
@rust-rfcbot
Copy link
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

@traviscross traviscross removed I-lang-nominated P-lang-drag-1 Lang team prioritization drag level 1. labels Nov 5, 2025
@nikomatsakis
Copy link
Contributor

@rfcbot reviewed

This has indeed always been intended as a guarantee. God help us when some new architecture opts for 1's complement. I guess we'll take that change. 🤣

@rust-rfcbot
Copy link
Collaborator

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

Thanks!

@ehuss ehuss added this pull request to the merge queue Nov 12, 2025
Merged via the queue into rust-lang:master with commit 9753ddb Nov 12, 2025
5 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Nov 12, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 17, 2025
Update books

## rust-lang/book

61 commits in f660f341887c8bbcd6c24fbfdf5d2a262f523965..f78ab89d7545ac17780e6a367055cc089f4cd2ec
2025-11-10 03:30:48 UTC to 2025-01-22 16:19:58 UTC

- Merge 3rd ed to main (rust-lang/book#4567)
- Fix typo in section 17.2 (rust-lang/book#4456)
- Chapter 19 from tech review (rust-lang/book#4446)
- Chapter 18 from tech review (rust-lang/book#4445)
- Chapter 16 from tech review (rust-lang/book#4438)
- WIP ch 17 edits after tech review (rust-lang/book#4319)
- Chapter 15 from tech review (rust-lang/book#4433)
- Chapter 14 from tech review (rust-lang/book#4423)
- Chapter 13 from tech review (rust-lang/book#4421)
- Chapter 12 from tech review (rust-lang/book#4410)
- Chapter 11 from tech review (rust-lang/book#4391)
- Chapter 10 from tech review (rust-lang/book#4379)
- Chapter 9 from tech review (rust-lang/book#4377)
- Chapter 8 from tech review (rust-lang/book#4378)
- Chapter 7 from tech review (rust-lang/book#4374)
- Chapter 6 from tech review (rust-lang/book#4370)
- Chapter 5 from tech review (rust-lang/book#4359)
- Chapter 4 from tech review (rust-lang/book#4358)
- Chapter 3 from tech review (rust-lang/book#4353)
- Ch01+ch02 after tech review (rust-lang/book#4329)
- Ch. 21: call out Chrome multiple-connections issue (rust-lang/book#4297)
- Ch. 16: refactor 16-6 to using listing component (rust-lang/book#4295)
- Ch. 01: Show how to work offline (rust-lang/book#4294)
- Ch. 07: Clarify sentences about `pub use` (rust-lang/book#4293)
- Ch. 02: Consistent ordering of `use` statements (rust-lang/book#4292)
- Anchors on listings (rust-lang/book#4271)
- Ch. 17: another tweak to how we phrase things about sections (rust-lang/book#4288)
- Ch. 20: correct listing number (rust-lang/book#4287)
- Ch. 10.3: clarify language detail (rust-lang/book#4284)
- Ch. 17: minor typos and link reference (rust-lang/book#4286)
- Ch. 9: correctly demonstrate privacy with module (rust-lang/book#4282)
- Ch. 18: correct discussion of delegation in `Post` methods (rust-lang/book#4281)
- Ch. 20: tell folks to see the Reference for more ABI info (rust-lang/book#4165)
- Ch 10.1 minor clarifications (rust-lang/book#4256)
- Clarified the misunderstanding b/w crates, module, items (rust-lang/book#4232)
- Ferris: always show, even when it’s small (rust-lang/book#4280)
- Ch. 17: mention `use std::pin::{Pin, pin};` on introduction (rust-lang/book#4279)
- Persist printing error, NOT ErrorKind (rust-lang/book#4259)
- Typo: "2" should be "2 seconds" (rust-lang/book#4263)
- Ch. 17: fix tiny example consistency issue (rust-lang/book#4270)
- Bump ring from 0.17.8 to 0.17.13 in /listings/ch17-async-await/listing-17-02 (rust-lang/book#4261)
- Bump ring from 0.17.8 to 0.17.14 in /packages/trpl (rust-lang/book#4273)
- 2024 Print Edition: updates to Word docs and more fixes to Markdown text (rust-lang/book#4272)
- Ch. 10: Make social media discussion generic. (rust-lang/book#4249)
- Another Ch. 17 -> 18 fix (rust-lang/book#4247)
- Ch. 05: further tweak to wording about `user1` availability (rust-lang/book#4246)
- Ch. 02: Fix rand version mistake (from testing) (rust-lang/book#4245)
- Ch. 19: Correct the discussion of `fn` type and closures (rust-lang/book#4244)
- Edition maintenance: scripting the updates for future work (rust-lang/book#4243)
- Ch. 17: fresh-eyes edits (rust-lang/book#4242)
- Ch. 17: drop lifetime not required in 2024 Edition (rust-lang/book#4212)
- Appendix B, Operators: Replace “member access” with “field access” and “method call”. (rust-lang/book#4240)
- Update to Rust 1.85 and 2024 Edition! (rust-lang/book#4241)
- Chapter 1: fix 'four things' now that spacing is not emphasized (rust-lang/book#4239)
- Fix typos in chapter 17 (rust-lang/book#4238)
- NoStarch backports (rust-lang/book#4224)
- Fix example for `cargo fix` (rust-lang/book#4226)
- Add missing word in ch17-04-streams.md (rust-lang/book#4218)
- Fix typo in ch5.3 and in CONTRIBUTING.md (rust-lang/book#4216)
- chore: reformat src with dprint (rust-lang/book#4211)
- Redirects: get rid of the weird gap in Ch. 20 sections! (rust-lang/book#4209)

## rust-lang/edition-guide

1 commits in 5c621253d8f2a5a4adb64a6365905db67dffe3a2..9cf5443d632673c4d41edad5e8ed8be86eeb3b8f
2025-11-15 21:51:11 UTC to 2025-11-15 21:51:11 UTC

- Link to 1.56.0 and 1.85.0 blog posts (rust-lang/edition-guide#380)

## rust-lang/nomicon

4 commits in 60f0b30d8ec1c9eb5c2582f2ec55f1094b0f8c42..0fe83ab28985b99aba36a1f0dbde3e08286fefda
2025-11-15 00:03:14 UTC to 2025-11-05 20:56:09 UTC

- Fix grammar in ffi.md (rust-lang/nomicon#510)
- Add CITATION.cff (rust-lang/nomicon#507)
- Use the newest Layout::array size checks for vec-alloc (rust-lang/nomicon#508)
- review comment: dropck analysis is *not* trivial (rust-lang/nomicon#498)

## rust-lang/reference

6 commits in e122eefff3fef362eb7e0c08fb7ffbf5f9461905..f9f1d2a4149f02582aec2f8fcdfa5b596193b4e2
2025-11-16 15:23:27 UTC to 2025-11-09 15:04:53 UTC

- add 'system' to variadic ABIs (rust-lang/reference#2069)
- Guarantee the binary representation of `isize` explicitly (rust-lang/reference#2064)
- Update `no_implicit_prelude` to use the attribute template (rust-lang/reference#1914)
- Update `no_std` to use the attribute template (rust-lang/reference#1913)
- const_eval.md: be more clear where link leads to (rust-lang/reference#2083)
- specify s390x target features (rust-lang/reference#1972)

## rust-lang/rust-by-example

1 commits in 160e6bbca70b0c01aa4de88d19db7fc5ff8447c3..f944161716230641605b5e3733e1c81f10047fd4
2025-11-05 12:46:38 UTC to 2025-11-05 12:46:38 UTC

- Revise `Path` type documentation for clarity (rust-lang/rust-by-example#1972)
rust-timer added a commit to rust-lang/rust that referenced this pull request Nov 18, 2025
Rollup merge of #149031 - rustbot:docs-update, r=ehuss

Update books

## rust-lang/book

61 commits in f660f341887c8bbcd6c24fbfdf5d2a262f523965..f78ab89d7545ac17780e6a367055cc089f4cd2ec
2025-11-10 03:30:48 UTC to 2025-01-22 16:19:58 UTC

- Merge 3rd ed to main (rust-lang/book#4567)
- Fix typo in section 17.2 (rust-lang/book#4456)
- Chapter 19 from tech review (rust-lang/book#4446)
- Chapter 18 from tech review (rust-lang/book#4445)
- Chapter 16 from tech review (rust-lang/book#4438)
- WIP ch 17 edits after tech review (rust-lang/book#4319)
- Chapter 15 from tech review (rust-lang/book#4433)
- Chapter 14 from tech review (rust-lang/book#4423)
- Chapter 13 from tech review (rust-lang/book#4421)
- Chapter 12 from tech review (rust-lang/book#4410)
- Chapter 11 from tech review (rust-lang/book#4391)
- Chapter 10 from tech review (rust-lang/book#4379)
- Chapter 9 from tech review (rust-lang/book#4377)
- Chapter 8 from tech review (rust-lang/book#4378)
- Chapter 7 from tech review (rust-lang/book#4374)
- Chapter 6 from tech review (rust-lang/book#4370)
- Chapter 5 from tech review (rust-lang/book#4359)
- Chapter 4 from tech review (rust-lang/book#4358)
- Chapter 3 from tech review (rust-lang/book#4353)
- Ch01+ch02 after tech review (rust-lang/book#4329)
- Ch. 21: call out Chrome multiple-connections issue (rust-lang/book#4297)
- Ch. 16: refactor 16-6 to using listing component (rust-lang/book#4295)
- Ch. 01: Show how to work offline (rust-lang/book#4294)
- Ch. 07: Clarify sentences about `pub use` (rust-lang/book#4293)
- Ch. 02: Consistent ordering of `use` statements (rust-lang/book#4292)
- Anchors on listings (rust-lang/book#4271)
- Ch. 17: another tweak to how we phrase things about sections (rust-lang/book#4288)
- Ch. 20: correct listing number (rust-lang/book#4287)
- Ch. 10.3: clarify language detail (rust-lang/book#4284)
- Ch. 17: minor typos and link reference (rust-lang/book#4286)
- Ch. 9: correctly demonstrate privacy with module (rust-lang/book#4282)
- Ch. 18: correct discussion of delegation in `Post` methods (rust-lang/book#4281)
- Ch. 20: tell folks to see the Reference for more ABI info (rust-lang/book#4165)
- Ch 10.1 minor clarifications (rust-lang/book#4256)
- Clarified the misunderstanding b/w crates, module, items (rust-lang/book#4232)
- Ferris: always show, even when it’s small (rust-lang/book#4280)
- Ch. 17: mention `use std::pin::{Pin, pin};` on introduction (rust-lang/book#4279)
- Persist printing error, NOT ErrorKind (rust-lang/book#4259)
- Typo: "2" should be "2 seconds" (rust-lang/book#4263)
- Ch. 17: fix tiny example consistency issue (rust-lang/book#4270)
- Bump ring from 0.17.8 to 0.17.13 in /listings/ch17-async-await/listing-17-02 (rust-lang/book#4261)
- Bump ring from 0.17.8 to 0.17.14 in /packages/trpl (rust-lang/book#4273)
- 2024 Print Edition: updates to Word docs and more fixes to Markdown text (rust-lang/book#4272)
- Ch. 10: Make social media discussion generic. (rust-lang/book#4249)
- Another Ch. 17 -> 18 fix (rust-lang/book#4247)
- Ch. 05: further tweak to wording about `user1` availability (rust-lang/book#4246)
- Ch. 02: Fix rand version mistake (from testing) (rust-lang/book#4245)
- Ch. 19: Correct the discussion of `fn` type and closures (rust-lang/book#4244)
- Edition maintenance: scripting the updates for future work (rust-lang/book#4243)
- Ch. 17: fresh-eyes edits (rust-lang/book#4242)
- Ch. 17: drop lifetime not required in 2024 Edition (rust-lang/book#4212)
- Appendix B, Operators: Replace “member access” with “field access” and “method call”. (rust-lang/book#4240)
- Update to Rust 1.85 and 2024 Edition! (rust-lang/book#4241)
- Chapter 1: fix 'four things' now that spacing is not emphasized (rust-lang/book#4239)
- Fix typos in chapter 17 (rust-lang/book#4238)
- NoStarch backports (rust-lang/book#4224)
- Fix example for `cargo fix` (rust-lang/book#4226)
- Add missing word in ch17-04-streams.md (rust-lang/book#4218)
- Fix typo in ch5.3 and in CONTRIBUTING.md (rust-lang/book#4216)
- chore: reformat src with dprint (rust-lang/book#4211)
- Redirects: get rid of the weird gap in Ch. 20 sections! (rust-lang/book#4209)

## rust-lang/edition-guide

1 commits in 5c621253d8f2a5a4adb64a6365905db67dffe3a2..9cf5443d632673c4d41edad5e8ed8be86eeb3b8f
2025-11-15 21:51:11 UTC to 2025-11-15 21:51:11 UTC

- Link to 1.56.0 and 1.85.0 blog posts (rust-lang/edition-guide#380)

## rust-lang/nomicon

4 commits in 60f0b30d8ec1c9eb5c2582f2ec55f1094b0f8c42..0fe83ab28985b99aba36a1f0dbde3e08286fefda
2025-11-15 00:03:14 UTC to 2025-11-05 20:56:09 UTC

- Fix grammar in ffi.md (rust-lang/nomicon#510)
- Add CITATION.cff (rust-lang/nomicon#507)
- Use the newest Layout::array size checks for vec-alloc (rust-lang/nomicon#508)
- review comment: dropck analysis is *not* trivial (rust-lang/nomicon#498)

## rust-lang/reference

6 commits in e122eefff3fef362eb7e0c08fb7ffbf5f9461905..f9f1d2a4149f02582aec2f8fcdfa5b596193b4e2
2025-11-16 15:23:27 UTC to 2025-11-09 15:04:53 UTC

- add 'system' to variadic ABIs (rust-lang/reference#2069)
- Guarantee the binary representation of `isize` explicitly (rust-lang/reference#2064)
- Update `no_implicit_prelude` to use the attribute template (rust-lang/reference#1914)
- Update `no_std` to use the attribute template (rust-lang/reference#1913)
- const_eval.md: be more clear where link leads to (rust-lang/reference#2083)
- specify s390x target features (rust-lang/reference#1972)

## rust-lang/rust-by-example

1 commits in 160e6bbca70b0c01aa4de88d19db7fc5ff8447c3..f944161716230641605b5e3733e1c81f10047fd4
2025-11-05 12:46:38 UTC to 2025-11-05 12:46:38 UTC

- Revise `Path` type documentation for clarity (rust-lang/rust-by-example#1972)
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Nov 19, 2025
Update books

## rust-lang/book

61 commits in f660f341887c8bbcd6c24fbfdf5d2a262f523965..f78ab89d7545ac17780e6a367055cc089f4cd2ec
2025-11-10 03:30:48 UTC to 2025-01-22 16:19:58 UTC

- Merge 3rd ed to main (rust-lang/book#4567)
- Fix typo in section 17.2 (rust-lang/book#4456)
- Chapter 19 from tech review (rust-lang/book#4446)
- Chapter 18 from tech review (rust-lang/book#4445)
- Chapter 16 from tech review (rust-lang/book#4438)
- WIP ch 17 edits after tech review (rust-lang/book#4319)
- Chapter 15 from tech review (rust-lang/book#4433)
- Chapter 14 from tech review (rust-lang/book#4423)
- Chapter 13 from tech review (rust-lang/book#4421)
- Chapter 12 from tech review (rust-lang/book#4410)
- Chapter 11 from tech review (rust-lang/book#4391)
- Chapter 10 from tech review (rust-lang/book#4379)
- Chapter 9 from tech review (rust-lang/book#4377)
- Chapter 8 from tech review (rust-lang/book#4378)
- Chapter 7 from tech review (rust-lang/book#4374)
- Chapter 6 from tech review (rust-lang/book#4370)
- Chapter 5 from tech review (rust-lang/book#4359)
- Chapter 4 from tech review (rust-lang/book#4358)
- Chapter 3 from tech review (rust-lang/book#4353)
- Ch01+ch02 after tech review (rust-lang/book#4329)
- Ch. 21: call out Chrome multiple-connections issue (rust-lang/book#4297)
- Ch. 16: refactor 16-6 to using listing component (rust-lang/book#4295)
- Ch. 01: Show how to work offline (rust-lang/book#4294)
- Ch. 07: Clarify sentences about `pub use` (rust-lang/book#4293)
- Ch. 02: Consistent ordering of `use` statements (rust-lang/book#4292)
- Anchors on listings (rust-lang/book#4271)
- Ch. 17: another tweak to how we phrase things about sections (rust-lang/book#4288)
- Ch. 20: correct listing number (rust-lang/book#4287)
- Ch. 10.3: clarify language detail (rust-lang/book#4284)
- Ch. 17: minor typos and link reference (rust-lang/book#4286)
- Ch. 9: correctly demonstrate privacy with module (rust-lang/book#4282)
- Ch. 18: correct discussion of delegation in `Post` methods (rust-lang/book#4281)
- Ch. 20: tell folks to see the Reference for more ABI info (rust-lang/book#4165)
- Ch 10.1 minor clarifications (rust-lang/book#4256)
- Clarified the misunderstanding b/w crates, module, items (rust-lang/book#4232)
- Ferris: always show, even when it’s small (rust-lang/book#4280)
- Ch. 17: mention `use std::pin::{Pin, pin};` on introduction (rust-lang/book#4279)
- Persist printing error, NOT ErrorKind (rust-lang/book#4259)
- Typo: "2" should be "2 seconds" (rust-lang/book#4263)
- Ch. 17: fix tiny example consistency issue (rust-lang/book#4270)
- Bump ring from 0.17.8 to 0.17.13 in /listings/ch17-async-await/listing-17-02 (rust-lang/book#4261)
- Bump ring from 0.17.8 to 0.17.14 in /packages/trpl (rust-lang/book#4273)
- 2024 Print Edition: updates to Word docs and more fixes to Markdown text (rust-lang/book#4272)
- Ch. 10: Make social media discussion generic. (rust-lang/book#4249)
- Another Ch. 17 -> 18 fix (rust-lang/book#4247)
- Ch. 05: further tweak to wording about `user1` availability (rust-lang/book#4246)
- Ch. 02: Fix rand version mistake (from testing) (rust-lang/book#4245)
- Ch. 19: Correct the discussion of `fn` type and closures (rust-lang/book#4244)
- Edition maintenance: scripting the updates for future work (rust-lang/book#4243)
- Ch. 17: fresh-eyes edits (rust-lang/book#4242)
- Ch. 17: drop lifetime not required in 2024 Edition (rust-lang/book#4212)
- Appendix B, Operators: Replace “member access” with “field access” and “method call”. (rust-lang/book#4240)
- Update to Rust 1.85 and 2024 Edition! (rust-lang/book#4241)
- Chapter 1: fix 'four things' now that spacing is not emphasized (rust-lang/book#4239)
- Fix typos in chapter 17 (rust-lang/book#4238)
- NoStarch backports (rust-lang/book#4224)
- Fix example for `cargo fix` (rust-lang/book#4226)
- Add missing word in ch17-04-streams.md (rust-lang/book#4218)
- Fix typo in ch5.3 and in CONTRIBUTING.md (rust-lang/book#4216)
- chore: reformat src with dprint (rust-lang/book#4211)
- Redirects: get rid of the weird gap in Ch. 20 sections! (rust-lang/book#4209)

## rust-lang/edition-guide

1 commits in 5c621253d8f2a5a4adb64a6365905db67dffe3a2..9cf5443d632673c4d41edad5e8ed8be86eeb3b8f
2025-11-15 21:51:11 UTC to 2025-11-15 21:51:11 UTC

- Link to 1.56.0 and 1.85.0 blog posts (rust-lang/edition-guide#380)

## rust-lang/nomicon

4 commits in 60f0b30d8ec1c9eb5c2582f2ec55f1094b0f8c42..0fe83ab28985b99aba36a1f0dbde3e08286fefda
2025-11-15 00:03:14 UTC to 2025-11-05 20:56:09 UTC

- Fix grammar in ffi.md (rust-lang/nomicon#510)
- Add CITATION.cff (rust-lang/nomicon#507)
- Use the newest Layout::array size checks for vec-alloc (rust-lang/nomicon#508)
- review comment: dropck analysis is *not* trivial (rust-lang/nomicon#498)

## rust-lang/reference

6 commits in e122eefff3fef362eb7e0c08fb7ffbf5f9461905..f9f1d2a4149f02582aec2f8fcdfa5b596193b4e2
2025-11-16 15:23:27 UTC to 2025-11-09 15:04:53 UTC

- add 'system' to variadic ABIs (rust-lang/reference#2069)
- Guarantee the binary representation of `isize` explicitly (rust-lang/reference#2064)
- Update `no_implicit_prelude` to use the attribute template (rust-lang/reference#1914)
- Update `no_std` to use the attribute template (rust-lang/reference#1913)
- const_eval.md: be more clear where link leads to (rust-lang/reference#2083)
- specify s390x target features (rust-lang/reference#1972)

## rust-lang/rust-by-example

1 commits in 160e6bbca70b0c01aa4de88d19db7fc5ff8447c3..f944161716230641605b5e3733e1c81f10047fd4
2025-11-05 12:46:38 UTC to 2025-11-05 12:46:38 UTC

- Revise `Path` type documentation for clarity (rust-lang/rust-by-example#1972)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants