Skip to content

Commit 5ed5bb6

Browse files
authored
Merge pull request #1492 from asomers/bitflags_1.3.1
Fix the build with bitflags-1.3.0 and newer
2 parents 06b5d33 + 8acdaef commit 5ed5bb6

File tree

8 files changed

+36
-35
lines changed

8 files changed

+36
-35
lines changed

.cirrus.yml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ task:
1515
image: freebsd-11-4-release-amd64
1616
setup_script:
1717
- fetch https://sh.rustup.rs -o rustup.sh
18-
- sh rustup.sh -y --profile=minimal --default-toolchain 1.41.0
18+
- sh rustup.sh -y --profile=minimal --default-toolchain 1.46.0
1919
- $HOME/.cargo/bin/rustup target add i686-unknown-freebsd
2020
amd64_test_script:
2121
- . $HOME/.cargo/env
@@ -31,22 +31,19 @@ task:
3131
- name: OSX x86_64
3232
env:
3333
TARGET: x86_64-apple-darwin
34-
- name: OSX i686
34+
- name: iOS aarch64
3535
env:
36-
TARGET: i686-apple-darwin
36+
TARGET: aarch64-apple-ios
3737
DISABLE_TESTS: 1
38-
- name: iOS
38+
- name: iOS x86_64
3939
env:
40-
# To save VM startup time, test all iOS targets in a single task.
41-
# The startup and scheduling time was very significant for Travis, but
42-
# not known for Cirrus.
43-
TARGET: "aarch64-apple-ios;armv7-apple-ios;armv7s-apple-ios;i386-apple-ios;x86_64-apple-ios"
40+
TARGET: x86_64-apple-ios
4441
DISABLE_TESTS: 1
4542
osx_instance:
4643
image: catalina-xcode
4744
setup_script:
4845
- curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs
49-
- sh rustup.sh -y --profile=minimal --default-toolchain 1.41.0
46+
- sh rustup.sh -y --profile=minimal --default-toolchain 1.46.0
5047
- . $HOME/.cargo/env
5148
- bash ci/install.sh
5249
script:
@@ -101,7 +98,7 @@ task:
10198
setup_script:
10299
- mkdir /tmp/home
103100
- curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs
104-
- sh rustup.sh -y --profile=minimal --default-toolchain 1.41.0
101+
- sh rustup.sh -y --profile=minimal --default-toolchain 1.46.0
105102
- . $HOME/.cargo/env
106103
- bash ci/install.sh
107104
script:
@@ -119,13 +116,13 @@ task:
119116
- name: Linux x86_64
120117
env:
121118
TARGET: x86_64-unknown-linux-gnu
122-
TOOLCHAIN: 1.41.0
119+
TOOLCHAIN: 1.46.0
123120
- name: Linux x86_64 musl
124121
env:
125122
TARGET: x86_64-unknown-linux-musl
126-
TOOLCHAIN: 1.41.0
123+
TOOLCHAIN: 1.46.0
127124
container:
128-
image: rust:1.41
125+
image: rust:1.46
129126
setup_script:
130127
- rustup toolchain install $TOOLCHAIN
131128
- rustup target add --toolchain $TOOLCHAIN $TARGET
@@ -173,7 +170,7 @@ task:
173170
env:
174171
TARGET: x86_64-fuchsia
175172
container:
176-
image: rust:1.41
173+
image: rust:1.46
177174
setup_script:
178175
- rustup target add $TARGET
179176
script:

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,16 @@ This project adheres to [Semantic Versioning](https://semver.org/).
4444

4545
- Many more functions, mostly contructors, are now `const`.
4646
(#[1476](https://github.com/nix-rust/nix/pull/1476))
47+
(#[1492](https://github.com/nix-rust/nix/pull/1492))
4748

4849
- `sys::event::KEvent::filter` now returns a `Result` instead of being
4950
infalliable. The only cases where it will now return an error are cases
5051
where it previously would've had undefined behavior.
5152
(#[1484](https://github.com/nix-rust/nix/pull/1484))
5253

54+
- Minimum supported Rust version is now 1.46.0.
55+
([#1492](https://github.com/nix-rust/nix/pull/1492))
56+
5357
### Fixed
5458

5559
- Added more errno definitions for better backwards compatibility with
@@ -68,6 +72,10 @@ This project adheres to [Semantic Versioning](https://semver.org/).
6872
for all platforms.
6973
(#[1484](https://github.com/nix-rust/nix/pull/1484))
7074

75+
- Removed support for 32-bit Apple targets, since they've been dropped by both
76+
Rustc and Xcode.
77+
(#[1492](https://github.com/nix-rust/nix/pull/1492))
78+
7179
## [0.22.0] - 9 July 2021
7280
### Added
7381
- Added `if_nameindex` (#[1445](https://github.com/nix-rust/nix/pull/1445))

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ targets = [
2626

2727
[dependencies]
2828
libc = { git = "https://github.com/rust-lang/libc", rev = "f5e31f208", features = [ "extra_traits" ] }
29-
bitflags = "1.1"
29+
bitflags = "1.3.1"
3030
cfg-if = "1.0"
3131

3232
[target.'cfg(not(target_os = "redox"))'.dependencies]

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,7 @@ Tier 2:
6868
* aarch64-linux-android
6969
* arm-linux-androideabi
7070
* arm-unknown-linux-musleabi
71-
* armv7-apple-ios
7271
* armv7-linux-androideabi
73-
* armv7s-apple-ios
74-
* i386-apple-ios
75-
* i686-apple-darwin
7672
* i686-linux-android
7773
* powerpc-unknown-linux-gnu
7874
* s390x-unknown-linux-gnu
@@ -87,7 +83,7 @@ Tier 3:
8783

8884
## Usage
8985

90-
`nix` requires Rust 1.41.0 or newer.
86+
`nix` requires Rust 1.46.0 or newer.
9187

9288
To use `nix`, add this to your `Cargo.toml`:
9389

src/errno.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl Errno {
9393
desc(self)
9494
}
9595

96-
pub fn from_i32(err: i32) -> Errno {
96+
pub const fn from_i32(err: i32) -> Errno {
9797
from_i32(err)
9898
}
9999

@@ -928,7 +928,7 @@ mod consts {
928928
pub const ENOTSUP: Errno = Errno::EOPNOTSUPP;
929929
}
930930

931-
pub fn from_i32(e: i32) -> Errno {
931+
pub const fn from_i32(e: i32) -> Errno {
932932
use self::Errno::*;
933933

934934
match e {
@@ -1207,7 +1207,7 @@ mod consts {
12071207
pub const EDEADLOCK: Errno = Errno::EDEADLK;
12081208
}
12091209

1210-
pub fn from_i32(e: i32) -> Errno {
1210+
pub const fn from_i32(e: i32) -> Errno {
12111211
use self::Errno::*;
12121212

12131213
match e {
@@ -1455,7 +1455,7 @@ mod consts {
14551455
pub const EOPNOTSUPP: Errno = Errno::ENOTSUP;
14561456
}
14571457

1458-
pub fn from_i32(e: i32) -> Errno {
1458+
pub const fn from_i32(e: i32) -> Errno {
14591459
use self::Errno::*;
14601460

14611461
match e {
@@ -1692,7 +1692,7 @@ mod consts {
16921692
pub const EOPNOTSUPP: Errno = Errno::ENOTSUP;
16931693
}
16941694

1695-
pub fn from_i32(e: i32) -> Errno {
1695+
pub const fn from_i32(e: i32) -> Errno {
16961696
use self::Errno::*;
16971697

16981698
match e {
@@ -1916,7 +1916,7 @@ mod consts {
19161916
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
19171917
}
19181918

1919-
pub fn from_i32(e: i32) -> Errno {
1919+
pub const fn from_i32(e: i32) -> Errno {
19201920
use self::Errno::*;
19211921

19221922
match e {
@@ -2141,7 +2141,7 @@ mod consts {
21412141
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
21422142
}
21432143

2144-
pub fn from_i32(e: i32) -> Errno {
2144+
pub const fn from_i32(e: i32) -> Errno {
21452145
use self::Errno::*;
21462146

21472147
match e {
@@ -2350,7 +2350,7 @@ mod consts {
23502350
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
23512351
}
23522352

2353-
pub fn from_i32(e: i32) -> Errno {
2353+
pub const fn from_i32(e: i32) -> Errno {
23542354
use self::Errno::*;
23552355

23562356
match e {
@@ -2590,7 +2590,7 @@ mod consts {
25902590
pub const EWOULDBLOCK: Errno = Errno::EAGAIN;
25912591
}
25922592

2593-
pub fn from_i32(e: i32) -> Errno {
2593+
pub const fn from_i32(e: i32) -> Errno {
25942594
use self::Errno::*;
25952595

25962596
match e {

src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ macro_rules! libc_enum {
113113
$v enum $BitFlags {
114114
$($entries)*
115115
}
116-
#[allow(unused_doc_comment)]
117116
impl ::std::convert::TryFrom<$repr> for $BitFlags {
118117
type Error = $crate::Error;
118+
#[allow(unused_doc_comments)]
119119
fn try_from(x: $repr) -> $crate::Result<Self> {
120120
match x {
121121
$($try_froms)*

src/sys/signal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl Signal {
133133
/// This function is equivalent to `<Signal as AsRef<str>>::as_ref()`,
134134
/// with difference that returned string is `'static`
135135
/// and not bound to `self`'s lifetime.
136-
pub fn as_str(self) -> &'static str {
136+
pub const fn as_str(self) -> &'static str {
137137
match self {
138138
Signal::SIGHUP => "SIGHUP",
139139
Signal::SIGINT => "SIGINT",

src/sys/socket/addr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ impl AddressFamily {
237237
///
238238
/// Currently only supports these address families: Unix, Inet (v4 & v6), Netlink, Link/Packet
239239
/// and System. Returns None for unsupported or unknown address families.
240-
pub fn from_i32(family: i32) -> Option<AddressFamily> {
240+
pub const fn from_i32(family: i32) -> Option<AddressFamily> {
241241
match family {
242242
libc::AF_UNIX => Some(AddressFamily::Unix),
243243
libc::AF_INET => Some(AddressFamily::Inet),
@@ -314,15 +314,15 @@ impl InetAddr {
314314
}
315315
}
316316
/// Gets the IP address associated with this socket address.
317-
pub fn ip(&self) -> IpAddr {
317+
pub const fn ip(&self) -> IpAddr {
318318
match *self {
319319
InetAddr::V4(ref sa) => IpAddr::V4(Ipv4Addr(sa.sin_addr)),
320320
InetAddr::V6(ref sa) => IpAddr::V6(Ipv6Addr(sa.sin6_addr)),
321321
}
322322
}
323323

324324
/// Gets the port number associated with this socket address
325-
pub fn port(&self) -> u16 {
325+
pub const fn port(&self) -> u16 {
326326
match *self {
327327
InetAddr::V6(ref sa) => u16::from_be(sa.sin6_port),
328328
InetAddr::V4(ref sa) => u16::from_be(sa.sin_port),
@@ -393,7 +393,7 @@ impl IpAddr {
393393
}
394394
}
395395

396-
pub fn to_std(&self) -> net::IpAddr {
396+
pub const fn to_std(&self) -> net::IpAddr {
397397
match *self {
398398
IpAddr::V4(ref ip) => net::IpAddr::V4(ip.to_std()),
399399
IpAddr::V6(ref ip) => net::IpAddr::V6(ip.to_std()),

0 commit comments

Comments
 (0)