Migrate away from u32 as an offset/length type #647
Labels
major-change
A proposal to make a major change to rustc
T-compiler
Add this label so rfcbot knows to poll the compiler team
Proposal
Rustc stores a lot of lengths in
u32
, which reduces the size of data structures and on-disk formats that contain these lengths. But this strategy imposes an artificial limit on the size of various things, which users can and do hit. This MCP is a general proposal to stop doing this, as opposed to a single strategy to adopt instead of usingu32
. The right alternative strategy will be determined on a case-by-case basis by experimentation.Here are the examples I know of where users have reported running into the
u32
limitation:Result::unwrap()
on anErr
value: TryFromIntError(()) rust#112934[21u8; u32::MAX as usize]
rust#111613I expect that it is also possible to exceed the
u32
-based limit on arustc_index::newtype_index!
type, but we do not yet have any reports of those. I wouldn't be surprised if ICEs due tonewtype_index!
exhaustion are hiding behind the two cases we do have reports for.Mentors or Reviewers
Process
The main points of the Major Change Process are as follows:
@rustbot second
.-C flag
, then full team check-off is required.@rfcbot fcp merge
on either the MCP or the PR.You can read more about Major Change Proposals on forge.
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.
The text was updated successfully, but these errors were encountered: