You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's common for C APIs to define constant values to denote the "last" value in a set of constants, like ELAST or IPPROTO_MAX. This seems prone to weird bugs, and these constants provide very marginal benefit to Rust programmers. Since we're considering some breakage anyways, we should just remove these values where we are made aware of them.
Noticed that we have a lot of *MAX consts and deprecating manually is quite hard. We could write a script but it can cause a false positive, hmm. For now, I've edited the PR template to mention this concern.
An alternative to deleting these placeholder constants would be to still provide them but not make any guarantees about their value moving forward. This means that we would be free to change the value of these constants without it being considered a breaking change.
CI tests should specifically exclude these, although it would be nice to make CI fail only if our value for such constants is lower than the one on the system.
a bunch of constants got annotated with doc comments in 123456, and the new usage guidelines mention that these symbols are likely to change without libc releasing a breaking release 7.
i'm wondering if this issue needs rewording or otherwise repurposing?
These constants have valid uses that make them not worth removing, so we're going to keep them around. We have a bit in the usage guidelines to help users avoid issues here.
Activity
JohnTitor commentedon Mar 3, 2023
👍, before 0.3, I'd like to deprecate these values.
JohnTitor commentedon Apr 19, 2023
Noticed that we have a lot of
*MAXconsts and deprecating manually is quite hard. We could write a script but it can cause a false positive, hmm. For now, I've edited the PR template to mention this concern.Auto merge of #3207 - JohnTitor:placeholder-pr-template, r=JohnTitor
Amanieu commentedon Mar 15, 2024
An alternative to deleting these placeholder constants would be to still provide them but not make any guarantees about their value moving forward. This means that we would be free to change the value of these constants without it being considered a breaking change.
CI tests should specifically exclude these, although it would be nice to make CI fail only if our value for such constants is lower than the one on the system.
solarish: define `IP_BOUND_IF` and `IPV6_BOUND_IF`
solarish: define `IP_BOUND_IF` and `IPV6_BOUND_IF`
solarish: define `IP_BOUND_IF` and `IPV6_BOUND_IF`
solarish: define `IP_BOUND_IF` and `IPV6_BOUND_IF`
solarish: define `IP_BOUND_IF` and `IPV6_BOUND_IF`
60 remaining items
refactor: remove *MAX constants fitting rust-lang#3131
refactor: remove *MAX constants fitting rust-lang#3131
refactor: deprecate *MAX constants fitting rust-lang#3131
refactor: deprecate *COUNT consts fitting rust-lang#3131
refactor: annotate `ELAST` constants as unstable
refactor: annotate `ELAST` constants as unstable
refactor: annotate `ELAST` constants as unstable
refactor: annotate `ELAST` constants as unstable
refactor: deprecate *MAX constants fitting rust-lang#3131
refactor: deprecate *MAX constants fitting rust-lang#3131
refactor: deprecate *COUNT consts fitting rust-lang#3131
refactor: annotate `ELAST` constants as unstable
dybucc commentedon Jul 10, 2026
a bunch of constants got annotated with doc comments in 1 2 3 4 5 6, and the new usage guidelines mention that these symbols are likely to change without libc releasing a breaking release 7.
i'm wondering if this issue needs rewording or otherwise repurposing?
Footnotes
linux_l4re: annotate unstable
*NUMconstants #5123 ↩Annotate unstable
*MAXconstants #5122 ↩unix: annotate unstable
*COUNTconstants #5121 ↩Annotate unstable
*LASTconstants #5120 ↩freebsd: annotate unstable
RAND_MAX#5119 ↩bsd: Annotate
ELASTconstants as unstable #5118 ↩https://github.com/rust-lang/libc/blob/70c67fe2ec83eda97646b49cab2bcbd1603a65ea/src/lib.rs#L134 ↩
tgross35 commentedon Jul 21, 2026
These constants have valid uses that make them not worth removing, so we're going to keep them around. We have a bit in the usage guidelines to help users avoid issues here.