diff --git a/.cirrus.yml b/.cirrus.yml index c3d87611bd..132a048d59 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -39,7 +39,7 @@ task: image: freebsd-12-2-release-amd64 setup_script: - fetch https://sh.rustup.rs -o rustup.sh - - sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN + - sh rustup.sh -y --profile=minimal --default-toolchain 1.41.0 - . $HOME/.cargo/env - rustup target add i686-unknown-freebsd - rustup component add --toolchain $TOOLCHAIN clippy @@ -57,11 +57,32 @@ task: - name: OSX x86_64 env: TARGET: x86_64-apple-darwin +<<<<<<< HEAD +======= + - name: OSX i686 + env: + TARGET: i686-apple-darwin + DISABLE_TESTS: 1 + - name: iOS + env: + # To save VM startup time, test all iOS targets in a single task. + # The startup and scheduling time was very significant for Travis, but + # not known for Cirrus. + TARGET: "aarch64-apple-ios;armv7-apple-ios;armv7s-apple-ios;i386-apple-ios;x86_64-apple-ios" + DISABLE_TESTS: 1 +>>>>>>> parent of 5ed5bb6 (Merge pull request #1492 from asomers/bitflags_1.3.1) osx_instance: image: catalina-xcode setup_script: - curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs +<<<<<<< HEAD - sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN +======= + - sh rustup.sh -y --profile=minimal --default-toolchain 1.41.0 + - . $HOME/.cargo/env + - bash ci/install.sh + script: +>>>>>>> parent of 5ed5bb6 (Merge pull request #1492 from asomers/bitflags_1.3.1) - . $HOME/.cargo/env - rustup component add --toolchain $TOOLCHAIN clippy << : *TEST @@ -113,7 +134,11 @@ task: setup_script: - mkdir /tmp/home - curl --proto '=https' --tlsv1.2 -sSf -o rustup.sh https://sh.rustup.rs +<<<<<<< HEAD - sh rustup.sh -y --profile=minimal --default-toolchain $TOOLCHAIN +======= + - sh rustup.sh -y --profile=minimal --default-toolchain 1.41.0 +>>>>>>> parent of 5ed5bb6 (Merge pull request #1492 from asomers/bitflags_1.3.1) - . $HOME/.cargo/env - cargo install cross << : *TEST @@ -139,11 +164,21 @@ task: image: rust:1.46 env: TARGET: x86_64-unknown-linux-gnu +<<<<<<< HEAD +======= + TOOLCHAIN: 1.41.0 +>>>>>>> parent of 5ed5bb6 (Merge pull request #1492 from asomers/bitflags_1.3.1) - name: Linux x86_64 musl container: image: rust:1.46 env: TARGET: x86_64-unknown-linux-musl +<<<<<<< HEAD +======= + TOOLCHAIN: 1.41.0 + container: + image: rust:1.41 +>>>>>>> parent of 5ed5bb6 (Merge pull request #1492 from asomers/bitflags_1.3.1) setup_script: - rustup target add $TARGET - rustup component add clippy @@ -221,11 +256,32 @@ task: TARGET: x86_64-unknown-netbsd - name: Redox x86_64 env: +<<<<<<< HEAD TARGET: x86_64-unknown-redox # Redox requires a nightly compiler. # If stuff breaks, change nightly to the date in the toolchain_* # directory at https://static.redox-os.org TOOLCHAIN: nightly-2020-08-04 +======= + TARGET: x86_64-fuchsia + container: + image: rust:1.41 + setup_script: + - rustup target add $TARGET + script: + - cargo +$TOOLCHAIN check --target $TARGET + - cargo +$TOOLCHAIN check --target $TARGET --release + - cargo +$TOOLCHAIN check --all-targets --target $TARGET + before_cache_script: rm -rf $CARGO_HOME/registry/index + +# illumos toolchain isn't available via rustup until 1.50 +task: + name: illumos + env: + TARGET: x86_64-unknown-illumos + container: + image: rust:1.50 +>>>>>>> parent of 5ed5bb6 (Merge pull request #1492 from asomers/bitflags_1.3.1) setup_script: - rustup target add $TARGET - rustup toolchain install $TOOLCHAIN --profile minimal --target $TARGET diff --git a/CHANGELOG.md b/CHANGELOG.md index 90c0075ecf..bb962ad678 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). - Many more functions, mostly contructors, are now `const`. (#[1476](https://github.com/nix-rust/nix/pull/1476)) (#[1492](https://github.com/nix-rust/nix/pull/1492)) + - `sys::event::KEvent::filter` now returns a `Result` instead of being infalliable. The only cases where it will now return an error are cases where it previously would've had undefined behavior. diff --git a/Cargo.toml b/Cargo.toml index 298c16ebb8..bc5e337d55 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ targets = [ [dependencies] libc = { version = "0.2.102", features = [ "extra_traits" ] } -bitflags = "1.3.1" +bitflags = "1.1" cfg-if = "1.0" [target.'cfg(not(target_os = "redox"))'.dependencies] diff --git a/README.md b/README.md index 296f83fb9a..616ba0a0c9 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,11 @@ Tier 2: * aarch64-linux-android * arm-linux-androideabi * arm-unknown-linux-musleabi + * armv7-apple-ios * armv7-linux-androideabi + * armv7s-apple-ios + * i386-apple-ios + * i686-apple-darwin * i686-linux-android * powerpc-unknown-linux-gnu * s390x-unknown-linux-gnu @@ -86,7 +90,7 @@ Tier 3: ## Usage -`nix` requires Rust 1.46.0 or newer. +`nix` requires Rust 1.41.0 or newer. To use `nix`, add this to your `Cargo.toml`: diff --git a/src/errno.rs b/src/errno.rs index 3da246e823..0b4a2ad0f3 100644 --- a/src/errno.rs +++ b/src/errno.rs @@ -94,7 +94,7 @@ impl Errno { desc(self) } - pub const fn from_i32(err: i32) -> Errno { + pub fn from_i32(err: i32) -> Errno { from_i32(err) } @@ -930,7 +930,7 @@ mod consts { pub const ENOTSUP: Errno = Errno::EOPNOTSUPP; } - pub const fn from_i32(e: i32) -> Errno { + pub fn from_i32(e: i32) -> Errno { use self::Errno::*; match e { @@ -1209,7 +1209,7 @@ mod consts { pub const EDEADLOCK: Errno = Errno::EDEADLK; } - pub const fn from_i32(e: i32) -> Errno { + pub fn from_i32(e: i32) -> Errno { use self::Errno::*; match e { @@ -1457,7 +1457,7 @@ mod consts { pub const EOPNOTSUPP: Errno = Errno::ENOTSUP; } - pub const fn from_i32(e: i32) -> Errno { + pub fn from_i32(e: i32) -> Errno { use self::Errno::*; match e { @@ -1694,7 +1694,7 @@ mod consts { pub const EOPNOTSUPP: Errno = Errno::ENOTSUP; } - pub const fn from_i32(e: i32) -> Errno { + pub fn from_i32(e: i32) -> Errno { use self::Errno::*; match e { @@ -1918,7 +1918,7 @@ mod consts { pub const EWOULDBLOCK: Errno = Errno::EAGAIN; } - pub const fn from_i32(e: i32) -> Errno { + pub fn from_i32(e: i32) -> Errno { use self::Errno::*; match e { @@ -2143,7 +2143,7 @@ mod consts { pub const EWOULDBLOCK: Errno = Errno::EAGAIN; } - pub const fn from_i32(e: i32) -> Errno { + pub fn from_i32(e: i32) -> Errno { use self::Errno::*; match e { @@ -2352,7 +2352,7 @@ mod consts { pub const EWOULDBLOCK: Errno = Errno::EAGAIN; } - pub const fn from_i32(e: i32) -> Errno { + pub fn from_i32(e: i32) -> Errno { use self::Errno::*; match e { @@ -2592,7 +2592,7 @@ mod consts { pub const EWOULDBLOCK: Errno = Errno::EAGAIN; } - pub const fn from_i32(e: i32) -> Errno { + pub fn from_i32(e: i32) -> Errno { use self::Errno::*; match e { diff --git a/src/macros.rs b/src/macros.rs index 3ccbfdd43b..927e7e7c76 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -113,9 +113,9 @@ macro_rules! libc_enum { $v enum $BitFlags { $($entries)* } + #[allow(unused_doc_comment)] impl ::std::convert::TryFrom<$repr> for $BitFlags { type Error = $crate::Error; - #[allow(unused_doc_comments)] fn try_from(x: $repr) -> $crate::Result { match x { $($try_froms)* diff --git a/src/sys/signal.rs b/src/sys/signal.rs index e8c79d3367..2630c9e2b9 100644 --- a/src/sys/signal.rs +++ b/src/sys/signal.rs @@ -167,7 +167,7 @@ impl Signal { /// This function is equivalent to `>::as_ref()`, /// with difference that returned string is `'static` /// and not bound to `self`'s lifetime. - pub const fn as_str(self) -> &'static str { + pub fn as_str(self) -> &'static str { match self { Signal::SIGHUP => "SIGHUP", Signal::SIGINT => "SIGINT", diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs index b119642b3f..b84f83d5ec 100644 --- a/src/sys/socket/addr.rs +++ b/src/sys/socket/addr.rs @@ -237,7 +237,7 @@ impl AddressFamily { /// /// Currently only supports these address families: Unix, Inet (v4 & v6), Netlink, Link/Packet /// and System. Returns None for unsupported or unknown address families. - pub const fn from_i32(family: i32) -> Option { + pub fn from_i32(family: i32) -> Option { match family { libc::AF_UNIX => Some(AddressFamily::Unix), libc::AF_INET => Some(AddressFamily::Inet), @@ -316,7 +316,7 @@ impl InetAddr { } } /// Gets the IP address associated with this socket address. - pub const fn ip(&self) -> IpAddr { + pub fn ip(&self) -> IpAddr { match *self { InetAddr::V4(ref sa) => IpAddr::V4(Ipv4Addr(sa.sin_addr)), InetAddr::V6(ref sa) => IpAddr::V6(Ipv6Addr(sa.sin6_addr)), @@ -324,7 +324,7 @@ impl InetAddr { } /// Gets the port number associated with this socket address - pub const fn port(&self) -> u16 { + pub fn port(&self) -> u16 { match *self { InetAddr::V6(ref sa) => u16::from_be(sa.sin6_port), InetAddr::V4(ref sa) => u16::from_be(sa.sin_port), @@ -396,7 +396,7 @@ impl IpAddr { } } - pub const fn to_std(&self) -> net::IpAddr { + pub fn to_std(&self) -> net::IpAddr { match *self { IpAddr::V4(ref ip) => net::IpAddr::V4(ip.to_std()), IpAddr::V6(ref ip) => net::IpAddr::V6(ip.to_std()),