Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perform some safe dependency upgrades and add fixes for rust 1.74.1 #391

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
name = "zmq"
version = "0.10.0"
authors = [
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
]
license = "MIT/Apache-2.0"
description = "High-level bindings to the zeromq library"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion tests/compile-fail/no-leaking-poll-items.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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
33 changes: 23 additions & 10 deletions tests/compile-fail/socket-thread-unsafe.stderr
Original file line number Diff line number Diff line change
@@ -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, T>(f: F) -> JoinHandle<T>
| ----- required by a bound in this function
...
| F: Send + 'static,
| ^^^^ required by this bound in `spawn`
7 changes: 2 additions & 5 deletions zmq-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
[package]
name = "zmq-sys"
version = "0.12.0"
authors = [
"[email protected]",
"[email protected]",
]
authors = ["[email protected]", "[email protected]"]
license = "MIT/Apache-2.0"
description = "Low-level bindings to the zeromq library"
keywords = ["ffi", "bindings"]
Expand All @@ -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"