diff --git a/Cargo.toml b/Cargo.toml index 02e6c23c..7fcb62d9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,9 +2,9 @@ name = "zmq" version = "0.10.0" authors = [ - "a.rottmann@gmx.at", - "erick.tryzelaar@gmail.com", - "opensource@traversersearch.nl", + "a.rottmann@gmx.at", + "erick.tryzelaar@gmail.com", + "opensource@traversersearch.nl", ] license = "MIT/Apache-2.0" description = "High-level bindings to the zeromq library" @@ -26,14 +26,14 @@ default = ["zmq_has"] zmq_has = [] [dependencies] -bitflags = "1.0" +bitflags = "2.4" libc = "0.2.15" zmq-sys = { version = "0.12.0", path = "zmq-sys" } [dev-dependencies] trybuild = { version = "1" } -env_logger = { version = "0.9", default-features = false } -log = "0.4.3" +env_logger = { version = "0.10", default-features = false } +log = "0.4" nix = "0.23" quickcheck = "1" rand = "0.8" @@ -157,17 +157,17 @@ name = "psenvpub" path = "examples/zguide/psenvpub/main.rs" [[example]] -name="psenvsub" -path="examples/zguide/psenvsub/main.rs" +name = "psenvsub" +path = "examples/zguide/psenvsub/main.rs" [[example]] -name="rtreq" -path="examples/zguide/rtreq/main.rs" +name = "rtreq" +path = "examples/zguide/rtreq/main.rs" [[example]] -name="lbbroker" -path="examples/zguide/lbbroker/main.rs" +name = "lbbroker" +path = "examples/zguide/lbbroker/main.rs" [[example]] -name="asyncsrv" -path="examples/zguide/asyncsrv/main.rs" +name = "asyncsrv" +path = "examples/zguide/asyncsrv/main.rs" diff --git a/src/lib.rs b/src/lib.rs index 17dc0ccd..bfbe89e6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -371,7 +371,7 @@ pub fn version() -> (i32, i32, i32) { zmq_sys::zmq_version(&mut major, &mut minor, &mut patch); } - (major as i32, minor as i32, patch as i32) + (major, minor, patch) } struct RawContext { @@ -1016,6 +1016,7 @@ impl Socket { // is unfortunate. bitflags! { /// Type representing pending socket events. + #[derive(Debug, PartialEq, Clone, Copy)] pub struct PollEvents: i16 { /// For `poll()`, specifies to signal when a message/some data /// can be read from a socket. diff --git a/tests/compile-fail/no-leaking-poll-items.stderr b/tests/compile-fail/no-leaking-poll-items.stderr index 6a1692a7..ff8a39a7 100644 --- a/tests/compile-fail/no-leaking-poll-items.stderr +++ b/tests/compile-fail/no-leaking-poll-items.stderr @@ -4,7 +4,8 @@ error[E0597]: `socket` does not live long enough 3 | let _poll_item = { | ---------- borrow later stored here 4 | let socket = context.socket(zmq::PAIR).unwrap(); + | ------ binding `socket` declared here 5 | socket.as_poll_item(zmq::POLLIN) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ borrowed value does not live long enough + | ^^^^^^ borrowed value does not live long enough 6 | }; //~^ ERROR `socket` does not live long enough [E0597] | - `socket` dropped here while still borrowed diff --git a/tests/compile-fail/socket-thread-unsafe.stderr b/tests/compile-fail/socket-thread-unsafe.stderr index 9f5982b9..78ffa177 100644 --- a/tests/compile-fail/socket-thread-unsafe.stderr +++ b/tests/compile-fail/socket-thread-unsafe.stderr @@ -1,18 +1,31 @@ error[E0277]: `*mut c_void` cannot be shared between threads safely - --> tests/compile-fail/socket-thread-unsafe.rs:13:13 + --> tests/compile-fail/socket-thread-unsafe.rs:13:27 | -13 | let t = thread::spawn(move || { - | ^^^^^^^^^^^^^ `*mut c_void` cannot be shared between threads safely +13 | let t = thread::spawn(move || { + | _____________-------------_^ + | | | + | | required by a bound introduced by this call +14 | | t!(s.bind("tcp://127.0.0.1:12345")) +15 | | }); + | |_____^ `*mut c_void` cannot be shared between threads safely | = help: within `Socket`, the trait `Sync` is not implemented for `*mut c_void` - = note: required because it appears within the type `Socket` - = note: required because of the requirements on the impl of `Send` for `&Socket` +note: required because it appears within the type `Socket` + --> src/lib.rs + | + | pub struct Socket { + | ^^^^^^ + = note: required for `&Socket` to implement `Send` note: required because it's used within this closure --> tests/compile-fail/socket-thread-unsafe.rs:13:27 | -13 | let t = thread::spawn(move || { - | ___________________________^ -14 | | t!(s.bind("tcp://127.0.0.1:12345")) -15 | | }); - | |_____^ +13 | let t = thread::spawn(move || { + | ^^^^^^^ note: required by a bound in `spawn` + --> $RUST/std/src/thread/mod.rs + | + | pub fn spawn(f: F) -> JoinHandle + | ----- required by a bound in this function +... + | F: Send + 'static, + | ^^^^ required by this bound in `spawn` diff --git a/zmq-sys/Cargo.toml b/zmq-sys/Cargo.toml index 14507b86..84ae0fe5 100644 --- a/zmq-sys/Cargo.toml +++ b/zmq-sys/Cargo.toml @@ -1,10 +1,7 @@ [package] name = "zmq-sys" version = "0.12.0" -authors = [ - "a.rottmann@gmx.at", - "erick.tryzelaar@gmail.com", -] +authors = ["a.rottmann@gmx.at", "erick.tryzelaar@gmail.com"] license = "MIT/Apache-2.0" description = "Low-level bindings to the zeromq library" keywords = ["ffi", "bindings"] @@ -20,7 +17,7 @@ libc = "0.2.15" [build-dependencies] system-deps = "6" -zeromq-src = { version = "0.2.1" } +zeromq-src = { version = "0.3.1" } [package.metadata.system-deps] libzmq = "4.1"