Skip to content

refactor: remove *MAX constants fitting #3131#5147

Open
dybucc wants to merge 1 commit into
rust-lang:mainfrom
dybucc:_max-removal
Open

refactor: remove *MAX constants fitting #3131#5147
dybucc wants to merge 1 commit into
rust-lang:mainfrom
dybucc:_max-removal

Conversation

@dybucc

@dybucc dybucc commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Description

This PR completely removes the symbols that were deprecated in #5122. This follows from the comments
by @JohnTitor in [1]. In this instance, removal implies both deletion in the souce file where the
constant is declared and purging of the corresponding symbols in the SemVer-tracking file.

There were a few symbols that did not have any SemVer plain text files tracking them. Those are
listed below. It is believed that some of these are actually tracked, only on a top-level module
like unix, where removal in the corresponding source file (unix/mod.rs) would already count as a
full deletion in other child modules (e.g. unix/cygwin/mod.rs.) A second list with symbols that
were previously annotated with an allow(deprecated) but have now been altogether removed has also
been compiled further down. Some of those symbols are entire records and even FFI routines, so input
here would be appreciated.

  • PATH_MAX in Fuchsia (fuchsia/mod.rs.)
  • J1939_FILTER_MAX in the Linux UAPI (new/linux_uapi/linux/can/j1939.rs.)
  • LINK_MAX in QuRT (new/qurt/limits.rs.)
  • NAME_MAX in QuRT (new/qurt/limits.rs.)
  • PATH_MAX in QuRT (new/qurt/limits.rs.)
  • SIGRTMAX in QuRT (new/qurt/signals.rs.)
  • MAXPATHLEN in the top-level BSD module (unix/bsd/mod.rs.)
  • CPU_STATE_MAX in Apple (unix/bsd/apple/mod.rs.)
  • vnode_info_path in apple (unix/bsd/apple/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • IFSTATMAX in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • proc_vnodepathinfo in apple (unix/bsd/apple/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • processor_cpu_load_info in apple (unix/bsd/apple/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • processor_cpu_load_info_t in apple (unix/bsd/apple/mod.rs.)
    I'm not sure about removing pointers to whole records like this one, so input would be appreciated
    here.
  • processor_cpu_load_info_data_t in apple (unix/bsd/apple/mod.rs.)
    I'm not sure about removing pointers to whole records like this one, so input would be appreciated
    here.
  • PRI_MAX in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • PRI_MAX_IDLE in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • MAXINTERP in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • NGROUPS in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • NAME_MAX in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • NGROUPS_MAX in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • BC_BASE_MAX in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • BC_DIM_MAX in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • BC_SCALE_MAX in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • BC_STRING_MAX in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • CHARCLASS_NAME_MAX in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • COLL_WEIGHTS_MAX in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • EXPR_NEST_MAX in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • LINE_MAX in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • RE_DUP_MAX in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • PR_SCTP_INVALID_POLICY in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • PR_SCTP_VALID_POLICY in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • ifstat in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • NGROUPS_MAX in NetBSD (unix/bsd/netbsdlike/netbsd/mod.rs.)
  • PATH_MAX in Cygwin (unix/cygwin/mod.rs.)
  • PATH_MAX in Haiku (unix/haiku/mod.rs.)
  • B_PATH_NAME_LENGTH in Haiku (unix/haiku/native.rs.)
  • PF_MAX in the GNU Hurd (unix/hurd/mod.rs.)
  • PF_MAX in the GNU Hurd (unix/hurd/mod.rs.)
  • AF_MAX in the GNU Hurd (unix/hurd/mod.rs.)
  • NAME_MAX in the GNU Hurd (unix/hurd/mod.rs.)
  • NGROUPS_MAX in the GNU Hurd (unix/hurd/mod.rs.)
  • RTLD_DI_MAX in the GNU Hurd (unix/hurd/mod.rs.)
  • PATH_MAX in Linux-like OSs (unix/linux_like/mod.rs.)
  • KERN_PIDMAX in Android (unix/linux_like/android/mod.rs.)
  • KERN_NGROUPS_MAX in Android (unix/linux_like/android/mod.rs.)
  • SKF_AD_MAX in Linux (unix/linux_like/linux/mod.rs.)
  • __NFT_REG_MAX in Linux (unix/linux_like/linux/mod.rs.)
  • NFT_MSG_MAX in Linux (unix/linux_like/linux/mod.rs.)
  • KERN_PIDMAX in Linux (unix/linux_like/linux/mod.rs.)
  • KERN_NGROUPS_MAX in Linux (unix/linux_like/linux/mod.rs.)
  • AF_MAX in 32-bits Hexagon with musl (unix/linux_like/linux/musl/b32/hexagon/mod.rs.)
  • PF_MAX in 32-bits Hexagon with musl (unix/linux_like/linux/musl/b32/hexagon/mod.rs.)
  • EAI_MAX in horizon (unix/newlib/horizon/mod.rs.)
  • SIGRTMAX in RTEMS (unix/newlib/rtems/mod.rs.)
  • PATH_MAX in nto (unix/nto/mod.rs.)
  • USER_BC_BASE_MAX in nto (unix/nto/mod.rs.)
  • USER_BC_DIM_MAX in nto (unix/nto/mod.rs.)
  • USER_BC_SCALE_MAX in nto (unix/nto/mod.rs.)
  • USER_BC_STRING_MAX in nto (unix/nto/mod.rs.)
  • USER_BC_COLL_WEIGHTS_MAX in nto (unix/nto/mod.rs.)
  • USER_EXPR_NEST_MAX in nto (unix/nto/mod.rs.)
  • USER_LINE_MAX in nto (unix/nto/mod.rs.)
  • USER_RE_DUP_MAX in nto (unix/nto/mod.rs.)
  • PATH_MAX in Redox (unix/redox/mod.rs.)
  • FILNAME_MAX in Illumos (unix/solarish/illumos/mod.rs.)
  • fil_info in Illumos (unix/solarish/illumos/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • PATH_MAX in Solaris-like systems (unix/solarish/mod.rs.)
  • _PTHREAD_SHARED_SEM_NAME_MAX in VxWorks (unix/vxworks/mod.rs.)
  • AF_MAX in VxWorks (unix/vxworks/mod.rs.)
  • _PARM_NAME_MAX in VxWorks (unix/vxworks/mod.rs.)
  • _PARM_PATH_MAX in VxWorks (unix/vxworks/mod.rs.)
  • readdir_r in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_rwlock_timedrdlock in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_rwlock_timedwrlock in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_mutex_timedlock in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.

Due to some other constants relying on the now removed symbols, the following list contains the set
of symbols that had to be removed even though they were not strictly deprecated.

  • MAXPATHLEN in the top-level BSD module (unix/bsd/mod.rs.)
  • vnode_info_path in apple (unix/bsd/apple/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • proc_vnodepathinfo in apple (unix/bsd/apple/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • host_cpu_load_info in apple (unix/bsd/apple/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • processor_cpu_load_info in apple (unix/bsd/apple/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • host_cpu_load_info_t in apple (unix/bsd/apple/mod.rs.)
    I'm not sure about removing pointers to whole records like this one, so input would be appreciated
    here.
  • host_cpu_load_info_data_t in apple (unix/bsd/apple/mod.rs.)
    I'm not sure about removing pointers to whole records like this one, so input would be appreciated
    here.
  • processor_cpu_load_info_t in apple (unix/bsd/apple/mod.rs.)
    I'm not sure about removing pointers to whole records like this one, so input would be appreciated
    here.
  • processor_cpu_load_info_data_t in apple (unix/bsd/apple/mod.rs.)
    I'm not sure about removing pointers to whole records like this one, so input would be appreciated
    here.
  • PRI_MAX_IDLE in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • MAXINTERP in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • NGROUPS in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • PR_SCTP_INVALID_POLICY in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • PR_SCTP_VALID_POLICY in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
  • kinfo_vmentry in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • tcp_function_set in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • ifstat in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • kinfo_file in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • kinfo_getvmmap in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • procstat_getvmmap in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • procstat_freevmmap in FreeBSD (unix/bsd/freebsdlike/freebsd/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • uucred in NetBSD (unix/bsd/netbsdlike/netbsd/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • kinfo_vmentry in NetBSD (unix/bsd/netbsdlike/netbsd/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • kinfo_getvmmap in NetBSD (unix/bsd/netbsdlike/netbsd/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • FF_CNT in Android (unix/linux_like/android/mod.rs.)
  • INPUT_PROP_CNT in Android (unix/linux_like/android/mod.rs.)
  • EV_CNT in Android (unix/linux_like/android/mod.rs.)
  • SYN_CNT in Android (unix/linux_like/android/mod.rs.)
  • KEY_CNT in Android (unix/linux_like/android/mod.rs.)
  • REL_CNT in Android (unix/linux_like/android/mod.rs.)
  • ABS_CNT in Android (unix/linux_like/android/mod.rs.)
  • SW_CNT in Android (unix/linux_like/android/mod.rs.)
  • MSC_CNT in Android (unix/linux_like/android/mod.rs.)
  • LED_CNT in Android (unix/linux_like/android/mod.rs.)
  • REP_CNT in Android (unix/linux_like/android/mod.rs.)
  • SND_CNT in Android (unix/linux_like/android/mod.rs.)
  • uinput_user_dev in Android (unix/linux_like/android/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • FF_CNT in Linux (unix/linux_like/linux/mod.rs.)
  • INPUT_PROP_CNT in Linux (unix/linux_like/linux/mod.rs.)
  • EV_CNT in Linux (unix/linux_like/linux/mod.rs.)
  • SYN_CNT in Linux (unix/linux_like/linux/mod.rs.)
  • KEY_CNT in Linux (unix/linux_like/linux/mod.rs.)
  • REL_CNT in Linux (unix/linux_like/linux/mod.rs.)
  • ABS_CNT in Linux (unix/linux_like/linux/mod.rs.)
  • SW_CNT in Linux (unix/linux_like/linux/mod.rs.)
  • MSC_CNT in Linux (unix/linux_like/linux/mod.rs.)
  • LED_CNT in Linux (unix/linux_like/linux/mod.rs.)
  • REP_CNT in Linux (unix/linux_like/linux/mod.rs.)
  • SND_CNT in Linux (unix/linux_like/linux/mod.rs.)
  • uinput_user_dev in Linux (unix/linux_like/linux/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • fil_info in Illumos (unix/solarish/illumos/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • dirent in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • PTHREAD_MUTEX_INITIALIZER in VxWorks (unix/vxworks/mod.rs.)
  • PTHREAD_COND_INITIALIZER in VxWorks (unix/vxworks/mod.rs.)
  • PTHREAD_RWLOCK_INITIALIZER in VxWorks (unix/vxworks/mod.rs.)
  • pthread_cont_t in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • pthread_cond_init in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_cond_signal in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_cond_broadcast in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_cond_destroy in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_cond_wait in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_cond_timedwait in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • readdir_r in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_rwlock_t in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • pthread_rwlock_init in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_rwlock_destroy in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_rwlock_rdlock in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_rwlock_tryrdlock in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_rwlock_timedrdlock in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_rwlock_wrlock in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_rwlock_trywrlock in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_rwlock_timedwrlock in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_rwlock_unlock in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_mutex_t in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole records like this one, so input would be appreciated here.
  • pthread_mutex_init in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_mutex_destroy in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_mutex_lock in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_mutex_trylock in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_mutex_timedlock in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.
  • pthread_mutex_unlock in VxWorks (unix/vxworks/mod.rs.)
    I'm not sure about removing whole FFI routines like this one, so input would be appreciated here.

Sources

See #5122.

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot

rustbot commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in an OpenBSD module

cc @semarie

Some changes occurred in a solarish module

cc @jclulow, @pfmooney

Some changes occurred in a NetBSD-like module

cc @semarie

Some changes occurred in an Android module

cc @maurer

@dybucc dybucc force-pushed the _max-removal branch 2 times, most recently from 04dca5f to 92a4e90 Compare June 8, 2026 10:34
@dybucc dybucc changed the title refactor: remove *MAX constants fitting #3131 refactor: remove *MAX constants fitting #3131 Jun 8, 2026
@dybucc dybucc force-pushed the _max-removal branch 4 times, most recently from eb75c71 to 2fede99 Compare June 8, 2026 13:46
@rustbot

This comment has been minimized.

This follows from rust-lang#5118, where all these symbols were deprecated.
@JohnTitor then advised for their removal in a separate PR that was not
on track to a stable release.

There have been a few more symbols that had to be altogether removed
because they relied on the now non-existent constants. See the
accompanying PR for details.
@rustbot

rustbot commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@dybucc

dybucc commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

CI actually passes. There seems to be an issue with a glob import that is not used, but this has not
been changed in the patch (it's not even part of it, for that matter.) For some reason, rebasing
onto main with dependabot updates has ended up with a warning across all of my open PRs due to
that one (now apparently unused) import.

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.

2 participants