Skip to content

deprecate the <int type>_{MIN,MAX} constants - #5404

Open
telcharr wants to merge 3 commits into
rust-lang:mainfrom
telcharr:chore/deprecate-int-type-limits
Open

deprecate the <int type>_{MIN,MAX} constants#5404
telcharr wants to merge 3 commits into
rust-lang:mainfrom
telcharr:chore/deprecate-int-type-limits

Conversation

@telcharr

@telcharr telcharr commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #5166. Deprecates the <int type>_{MIN,MAX} constants across the platform modules, with notes pointing at the type's own MIN/MAX.

@rustbot label stable-nominated

@rustbot

rustbot commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in an Android module

cc @maurer

@rustbot rustbot added O-android O-linux O-linux-like O-unix O-windows S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Aug 11, 2026

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One requested update for the constants, assuming things check out after that then LGTM

View changes since this review

Comment thread src/fuchsia/mod.rs Outdated
Comment on lines 1186 to 1189
#[deprecated(since = "0.2.190", note = "Use `c_int::MIN` instead.")]
pub const INT_MIN: c_int = -1 - 0x7fffffff;
#[deprecated(since = "0.2.190", note = "Use `c_int::MAX` instead.")]
pub const INT_MAX: c_int = 0x7fffffff;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As part of this, would you mind changing the values to what we're suggesting to replace? E.g. pub const INT_MIN: c_int = c_int::MAX;

That way tests should pick up any cases where they don't match up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. I did move some values on 64-bit hurd, which I think were just wrong before. The *_FAST16/32 ones are c_long/ulong on that target and the pointer-width ones are isize/usize but all were written with 32-bit literals. One thing I'm a bit less sure on is that INTPTR_MIN/MAX and PTRDIFF_MIN/MAX needed their declared type moved to intptr_t/ptrdiff_t for this to compile since __intptr_t is c_long and won't unify with isize. If you'd rather I left those two alone let me know.

@rustbot

rustbot commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@telcharr

Copy link
Copy Markdown
Contributor Author

Couldn't find qurt, solid, switch, xous, or 64-bit hurd in the CI anywhere, so I built them locally with -Zbuild-std=core. All came back clean, apart from qurt at first, where core itself wouldn't build for hexagon on 1.97.1. I was able to get it to build on 1.99.0-nightly though. Same error as rust-lang/stdarch#2134.

@rustbot ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-android O-linux O-linux-like O-unix O-windows S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants