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

Bump to Rust edition 2021 #479

Merged
merged 6 commits into from
Apr 20, 2023
Merged
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
257 changes: 172 additions & 85 deletions Cargo.lock

Large diffs are not rendered by default.

56 changes: 28 additions & 28 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ authors = [
"Luca Cominardi <[email protected]>",
"Pierre Avital <[email protected]>",
]
edition = "2018"
edition = "2021"
license = "EPL-2.0 OR Apache-2.0"
categories = ["network-programming"]
description = "Zenoh: Zero Overhead Pub/sub, Store/Query and Compute."
Expand All @@ -70,7 +70,7 @@ description = "Zenoh: Zero Overhead Pub/sub, Store/Query and Compute."
# (https://github.com/rust-lang/cargo/issues/11329)
[workspace.dependencies]
aes = "0.8.2"
anyhow = { version = "1.0.66", default-features = false } # Default features are disabled due to usage in no_std crates
anyhow = { version = "1.0.69", default-features = false } # Default features are disabled due to usage in no_std crates
async-executor = "1.5.0"
async-global-executor = "2.3.1"
async-rustls = "0.3.0"
Expand All @@ -79,7 +79,7 @@ async-trait = "0.1.60"
base64 = "0.21.0"
bincode = "1.3.3"
clap = "3.2.23"
crc = "3.0.0"
crc = "3.0.1"
criterion = "0.4.0"
derive_more = "0.99.17"
derive-new = "0.5.9"
Expand All @@ -99,59 +99,59 @@ humantime = "2.1.0"
json5 = "0.4.1"
keyed-set = "0.4.4"
lazy_static = "1.4.0"
libc = "0.2.138"
libc = "0.2.139"
libloading = "0.7.4"
log = "0.4.17"
nix = "0.26.1"
num_cpus = "1.14.0"
nix = "0.26.2"
num_cpus = "1.15.0"
ordered-float = "3.4.0"
panic-message = "0.3.0"
paste = "1.0.9"
petgraph = "0.6.2"
pnet = "0.31.0"
pnet_datalink = "0.31.0"
proc-macro2 = "1.0.47"
paste = "1.0.12"
petgraph = "0.6.3"
pnet = "0.33.0"
pnet_datalink = "0.33.0"
proc-macro2 = "1.0.51"
quinn = "0.9.3"
quote = "1.0.21"
quote = "1.0.23"
rand = { version = "0.8.5", default-features = false } # Default features are disabled due to usage in no_std crates
rand_chacha = "0.3.1"
rcgen = "0.10.0"
regex = "1.7.0"
ringbuffer-spsc = "0.1.8"
rsa = "0.7.2"
regex = "1.7.1"
ringbuffer-spsc = "0.1.9"
rsa = "0.8.2"
rustc_version = "0.4.0"
rustls = "0.20.6"
rustls = "0.20.8"
rustls-native-certs = "0.6.2"
rustls-pemfile = "1.0.1"
serde = { version = "1.0.152", default-features = false, features = [
rustls-pemfile = "1.0.2"
serde = { version = "1.0.154", default-features = false, features = [
"derive",
] } # Default features are disabled due to usage in no_std crates
serde_json = "1.0.89"
serde_yaml = "0.9.14"
serde_json = "1.0.94"
serde_yaml = "0.9.19"
sha3 = "0.10.6"
shared_memory = "0.12.4"
shellexpand = "3.0.0"
socket2 = "0.4.7"
socket2 = "0.5.1"
stop-token = "0.7.0"
syn = "1.0.105"
syn = "1.0.109"
tide = "0.16.0"
token-cell = { version = "1.5.0", default-features = false }
tokio = { version = "1.23.1", default-features = false } # Default features are disabled due to some crates' requirements
token-cell = { version = "1.4.2", default-features = false }
tokio = { version = "1.26.0", default-features = false } # Default features are disabled due to some crates' requirements
tokio-tungstenite = "0.18.0"
typenum = "1.15.0"
typenum = "1.16.0"
uhlc = { version = "0.5.2", default-features = false } # Default features are disabled due to usage in no_std crates
unzip-n = "0.1.2"
url = "2.3.1"
urlencoding = "2.1.2"
uuid = { version = "1.2.2", default-features = false, features = [
uuid = { version = "1.3.0", default-features = false, features = [
"v4",
] } # Default features are disabled due to usage in no_std crates
validated_struct = "2.1.0"
vec_map = "0.8.2"
webpki = "0.22.0"
webpki-roots = "0.22.5"
webpki-roots = "0.22.6"
winapi = { version = "0.3.9", features = ["iphlpapi"] }
z-serial = "0.2.0"
z-serial = "0.2.1"

[profile.dev]
debug = true
Expand Down
2 changes: 1 addition & 1 deletion ci/nostd-check/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ homepage = "http://zenoh.io"
authors = [
"Davide Della Giustina <[email protected]>",
]
edition = "2018"
edition = "2021"
license = " EPL-2.0 OR Apache-2.0"
categories = ["network-programming"]
description = "Internal crate for zenoh."
Expand Down
1 change: 0 additions & 1 deletion commons/zenoh-protocol/src/scouting/hello.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ impl fmt::Display for Hello {
impl Hello {
#[cfg(feature = "test")]
pub fn rand() -> Self {
use core::iter::FromIterator;
use rand::Rng;

let mut rng = rand::thread_rng();
Expand Down
2 changes: 0 additions & 2 deletions commons/zenoh-protocol/src/transport/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ impl Frame {
#[cfg(feature = "test")]
pub fn rand() -> Self {
use crate::core::{Priority, Reliability};
use core::convert::TryInto;
use rand::Rng;

const MIN: usize = 1;
Expand Down Expand Up @@ -157,7 +156,6 @@ impl FrameHeader {
#[cfg(feature = "test")]
pub fn rand() -> Self {
use crate::core::{Priority, Reliability};
use core::convert::TryInto;
use rand::{seq::SliceRandom, Rng};

let mut rng = rand::thread_rng();
Expand Down
1 change: 0 additions & 1 deletion commons/zenoh-protocol/src/zenoh/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ pub struct DataInfo {
impl DataInfo {
#[cfg(feature = "test")]
pub fn rand() -> Self {
use core::convert::TryFrom;
use rand::Rng;

let mut rng = rand::thread_rng();
Expand Down
1 change: 0 additions & 1 deletion commons/zenoh-protocol/src/zenoh/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ impl ZenohMessage {
#[cfg(feature = "test")]
pub fn rand() -> Self {
use crate::core::Priority;
use core::convert::TryInto;
use rand::Rng;

let mut rng = rand::thread_rng();
Expand Down
4 changes: 0 additions & 4 deletions commons/zenoh-util/src/std_only/net/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ pub fn set_linger(socket: &TcpStream, dur: Option<Duration>) -> ZResult<()> {

#[cfg(windows)]
{
use std::convert::TryInto;
use std::os::windows::io::AsRawSocket;
use winapi::um::winsock2;
use winapi::um::ws2tcpip;
Expand Down Expand Up @@ -114,7 +113,6 @@ pub fn get_interface(name: &str) -> ZResult<Option<IpAddr>> {
{
unsafe {
use crate::ffi;
use std::convert::TryInto;
use winapi::um::iptypes::IP_ADAPTER_ADDRESSES_LH;

let mut ret;
Expand Down Expand Up @@ -215,7 +213,6 @@ pub fn get_local_addresses() -> ZResult<Vec<IpAddr>> {
{
unsafe {
use crate::ffi;
use std::convert::TryInto;
use winapi::um::iptypes::IP_ADAPTER_ADDRESSES_LH;

let mut result = vec![];
Expand Down Expand Up @@ -307,7 +304,6 @@ pub fn get_unicast_addresses_of_interface(name: &str) -> ZResult<Vec<IpAddr>> {
{
unsafe {
use crate::ffi;
use std::convert::TryInto;
use winapi::um::iptypes::IP_ADAPTER_ADDRESSES_LH;

let mut addrs = vec![];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ use crate::unicast::establishment::Cookie;
use async_std::sync::Mutex;
use async_trait::async_trait;
use rand::SeedableRng;
use rsa::pkcs1::{DecodeRsaPrivateKey, DecodeRsaPublicKey};
use rsa::{BigUint, PaddingScheme, PublicKey, PublicKeyParts, RsaPrivateKey, RsaPublicKey};
use rsa::{
pkcs1::{DecodeRsaPrivateKey, DecodeRsaPublicKey},
BigUint, Pkcs1v15Encrypt, PublicKey, PublicKeyParts, RsaPrivateKey, RsaPublicKey,
};
use std::collections::HashMap;
use std::ops::Deref;
use std::path::Path;
Expand Down Expand Up @@ -476,7 +478,7 @@ impl PeerAuthenticatorTrait for PubKeyAuthenticator {
let nonce_bytes = wbuf;
let nonce_encrypted_with_alice_pubkey = init_syn_property.alice_pubkey.encrypt(
&mut guard.prng,
PaddingScheme::PKCS1v15Encrypt,
Pkcs1v15Encrypt,
nonce_bytes.as_slice(),
)?;

Expand Down Expand Up @@ -542,19 +544,18 @@ impl PeerAuthenticatorTrait for PubKeyAuthenticator {
)
})?;
let nonce = self.pri_key.decrypt(
PaddingScheme::PKCS1v15Encrypt,
Pkcs1v15Encrypt,
init_ack_property
.nonce_encrypted_with_alice_pubkey
.as_slice(),
)?;

// Create the OpenSyn attachment
let mut guard = zasynclock!(self.state);
let nonce_encrypted_with_bob_pubkey = init_ack_property.bob_pubkey.encrypt(
&mut guard.prng,
PaddingScheme::PKCS1v15Encrypt,
&nonce[..],
)?;
let nonce_encrypted_with_bob_pubkey =
init_ack_property
.bob_pubkey
.encrypt(&mut guard.prng, Pkcs1v15Encrypt, &nonce[..])?;
drop(guard);

let open_syn_property = OpenSynProperty {
Expand Down Expand Up @@ -591,7 +592,7 @@ impl PeerAuthenticatorTrait for PubKeyAuthenticator {
})?;

let nonce_bytes = self.pri_key.decrypt(
PaddingScheme::PKCS1v15Encrypt,
Pkcs1v15Encrypt,
open_syn_property.nonce_encrypted_with_bob_pubkey.as_slice(),
)?;
let mut reader = nonce_bytes.reader();
Expand Down
1 change: 0 additions & 1 deletion io/zenoh-transport/tests/multicast_transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ mod tests {
async fn open_transport(
endpoint: &EndPoint,
) -> (TransportMulticastPeer, TransportMulticastPeer) {
use std::convert::TryFrom;
// Define peer01 and peer02 IDs
let peer01_id = ZenohId::try_from([1]).unwrap();
let peer02_id = ZenohId::try_from([2]).unwrap();
Expand Down
3 changes: 0 additions & 3 deletions io/zenoh-transport/tests/unicast_authenticator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ impl TransportEventHandler for SHClientAuthenticator {

#[cfg(feature = "auth_pubkey")]
async fn authenticator_multilink(endpoint: &EndPoint) {
use std::convert::TryFrom;
use zenoh_transport::TransportManager;

// Create the router transport manager
Expand Down Expand Up @@ -515,7 +514,6 @@ async fn authenticator_multilink(endpoint: &EndPoint) {

#[cfg(feature = "auth_usrpwd")]
async fn authenticator_user_password(endpoint: &EndPoint) {
use std::convert::TryFrom;
use zenoh_transport::TransportManager;

/* [CLIENT] */
Expand Down Expand Up @@ -698,7 +696,6 @@ async fn authenticator_user_password(endpoint: &EndPoint) {

#[cfg(feature = "shared-memory")]
async fn authenticator_shared_memory(endpoint: &EndPoint) {
use std::convert::TryFrom;
use zenoh_transport::TransportManager;

/* [CLIENT] */
Expand Down
2 changes: 1 addition & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
edition = "2018"
edition = "2021"
use_try_shorthand = true
use_field_init_shorthand = true

Expand Down