Skip to content

Commit

Permalink
Revert "Merge pull request nix-rust#1492 from asomers/bitflags_1.3.1"
Browse files Browse the repository at this point in the history
This reverts commit 5ed5bb6, reversing
changes made to 06b5d33.
  • Loading branch information
pacak committed Sep 29, 2021
1 parent d194b38 commit aeb4745
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 18 deletions.
58 changes: 57 additions & 1 deletion .cirrus.yml
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -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]
Expand Down
6 changes: 5 additions & 1 deletion README.md
Expand Up @@ -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
Expand All @@ -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`:

Expand Down
18 changes: 9 additions & 9 deletions src/errno.rs
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/macros.rs
Expand Up @@ -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<Self> {
match x {
$($try_froms)*
Expand Down
2 changes: 1 addition & 1 deletion src/sys/signal.rs
Expand Up @@ -167,7 +167,7 @@ impl Signal {
/// This function is equivalent to `<Signal as AsRef<str>>::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",
Expand Down
8 changes: 4 additions & 4 deletions src/sys/socket/addr.rs
Expand Up @@ -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<AddressFamily> {
pub fn from_i32(family: i32) -> Option<AddressFamily> {
match family {
libc::AF_UNIX => Some(AddressFamily::Unix),
libc::AF_INET => Some(AddressFamily::Inet),
Expand Down Expand Up @@ -316,15 +316,15 @@ 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)),
}
}

/// 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),
Expand Down Expand Up @@ -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()),
Expand Down

0 comments on commit aeb4745

Please sign in to comment.