Skip to content

Commit 8ec90b6

Browse files
committed
refactor: deprecate ELAST constants
This set of constants had already been discussed to cause some issues in #3131. This patch deprecates such bu-prone and latest-error symbols such that the interface to the `libc` crate is not prone to SemVer-breakage as often as the values change upstream.
1 parent dbd7ad9 commit 8ec90b6

8 files changed

Lines changed: 48 additions & 0 deletions

File tree

src/unix/bsd/apple/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,6 +2143,12 @@ pub const ENOTRECOVERABLE: c_int = 104;
21432143
pub const EOWNERDEAD: c_int = 105;
21442144
pub const EQFULL: c_int = 106;
21452145
pub const ENOTCAPABLE: c_int = 107;
2146+
#[deprecated(
2147+
since = "0.2.187",
2148+
note = "This constant, among others often used in C for the purposes of denoting the latest \
2149+
value or limit in a set of constants, has been deprecated. See #3131 for details and \
2150+
discussion."
2151+
)]
21462152
pub const ELAST: c_int = 107;
21472153

21482154
pub const EAI_AGAIN: c_int = 2;

src/unix/bsd/freebsdlike/dragonfly/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,12 @@ pub const ENOMEDIUM: c_int = 93;
548548
pub const ENOTRECOVERABLE: c_int = 94;
549549
pub const EOWNERDEAD: c_int = 95;
550550
pub const EASYNC: c_int = 99;
551+
#[deprecated(
552+
since = "0.2.187",
553+
note = "This constant, among others often used in C for the purposes of denoting the latest \
554+
value or limit in a set of constants, has been deprecated. See #3131 for details and \
555+
discussion."
556+
)]
551557
pub const ELAST: c_int = 99;
552558
pub const RLIMIT_POSIXLOCKS: c_int = 11;
553559
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]

src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,12 @@ s! {
258258
}
259259
}
260260

261+
#[deprecated(
262+
since = "0.2.187",
263+
note = "This constant, among others often used in C for the purposes of denoting the latest \
264+
value or limit in a set of constants, has been deprecated. See #3131 for details and \
265+
discussion."
266+
)]
261267
pub const ELAST: c_int = 96;
262268
pub const RAND_MAX: c_int = 0x7fff_fffd;
263269
pub const KI_NSPARE_PTR: usize = 6;

src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,12 @@ s! {
304304
}
305305

306306
pub const RAND_MAX: c_int = 0x7fff_fffd;
307+
#[deprecated(
308+
since = "0.2.187",
309+
note = "This constant, among others often used in C for the purposes of denoting the latest \
310+
value or limit in a set of constants, has been deprecated. See #3131 for details and \
311+
discussion."
312+
)]
307313
pub const ELAST: c_int = 97;
308314

309315
/// max length of devicename

src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,12 @@ s! {
317317
}
318318

319319
pub const RAND_MAX: c_int = 0x7fff_ffff;
320+
#[deprecated(
321+
since = "0.2.187",
322+
note = "This constant, among others often used in C for the purposes of denoting the latest \
323+
value or limit in a set of constants, has been deprecated. See #3131 for details and \
324+
discussion."
325+
)]
320326
pub const ELAST: c_int = 97;
321327

322328
pub const KF_TYPE_EVENTFD: c_int = 13;

src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,12 @@ s! {
319319
}
320320

321321
pub const RAND_MAX: c_int = 0x7fff_ffff;
322+
#[deprecated(
323+
since = "0.2.187",
324+
note = "This constant, among others often used in C for the purposes of denoting the latest \
325+
value or limit in a set of constants, has been deprecated. See #3131 for details and \
326+
discussion."
327+
)]
322328
pub const ELAST: c_int = 97;
323329

324330
pub const KF_TYPE_EVENTFD: c_int = 13;

src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,12 @@ s! {
321321
}
322322

323323
pub const RAND_MAX: c_int = 0x7fff_ffff;
324+
#[deprecated(
325+
since = "0.2.187",
326+
note = "This constant, among others often used in C for the purposes of denoting the latest \
327+
value or limit in a set of constants, has been deprecated. See #3131 for details and \
328+
discussion."
329+
)]
324330
pub const ELAST: c_int = 97;
325331

326332
pub const KF_TYPE_EVENTFD: c_int = 13;

src/unix/bsd/netbsdlike/openbsd/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,12 @@ pub const EBADMSG: c_int = 92;
945945
pub const ENOTRECOVERABLE: c_int = 93;
946946
pub const EOWNERDEAD: c_int = 94;
947947
pub const EPROTO: c_int = 95;
948+
#[deprecated(
949+
since = "0.2.187",
950+
note = "This constant, among others often used in C for the purposes of denoting the latest \
951+
value or limit in a set of constants, has been deprecated. See #3131 for details and \
952+
discussion."
953+
)]
948954
pub const ELAST: c_int = 95;
949955

950956
pub const F_DUPFD_CLOEXEC: c_int = 10;

0 commit comments

Comments
 (0)