Skip to content

Commit

Permalink
Bump rust-toolchain and lot of dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
JEnoch committed Sep 11, 2023
1 parent d501634 commit 8c363d8
Show file tree
Hide file tree
Showing 12 changed files with 402 additions and 327 deletions.
585 changes: 305 additions & 280 deletions Cargo.lock

Large diffs are not rendered by default.

25 changes: 13 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# ZettaScale Zenoh Team, <zenoh@zettascale.tech>
#
[workspace]
resolver = "2"
members = [
"commons/zenoh-buffers",
"commons/zenoh-codec",
Expand Down Expand Up @@ -81,17 +82,17 @@ bincode = "1.3.3"
clap = "3.2.23"
const_format = "0.2.30"
crc = "3.0.1"
criterion = "0.4.0"
criterion = "0.5"
derive_more = "0.99.17"
derive-new = "0.5.9"
env_logger = "0.10.0"
event-listener = "2.5.3"
flume = "0.10.14"
flume = "0.11"
form_urlencoded = "1.1.0"
futures = "0.3.25"
futures-util = { version = "0.3.25", default-features = false } # Default features are disabled due to some crates' requirements
git-version = "0.3.5"
hashbrown = "0.13.2"
hashbrown = "0.14"
hex = { version = "0.4.3", default-features = false } # Default features are disabled due to usage in no_std crates
hmac = { version = "0.12.1", features = ["std"] }
home = "0.5.4"
Expand All @@ -102,26 +103,26 @@ jsonschema = "0.17.1"
keyed-set = "0.4.4"
lazy_static = "1.4.0"
libc = "0.2.139"
libloading = "0.7.4"
libloading = "0.8"
log = "0.4.17"
lz4_flex = "0.10.0"
nix = "0.26.2"
lz4_flex = "0.11"
nix = { version = "0.27", features = ["fs"] }
num_cpus = "1.15.0"
ordered-float = "3.4.0"
panic-message = "0.3.0"
paste = "1.0.12"
petgraph = "0.6.3"
pnet = "0.33.0"
pnet_datalink = "0.33.0"
pnet = "0.34"
pnet_datalink = "0.34"
proc-macro2 = "1.0.51"
quinn = "0.10.1"
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"
rcgen = "0.11"
regex = "1.7.1"
ringbuffer-spsc = "0.1.9"
rsa = "0.8.2"
rsa = "0.9"
rustc_version = "0.4.0"
rustls = { version = "0.21.5", features = ["dangerous_configuration"] }
rustls-native-certs = "0.6.2"
Expand All @@ -137,11 +138,11 @@ shared_memory = "0.12.4"
shellexpand = "3.0.0"
socket2 = "0.5.1"
stop-token = "0.7.0"
syn = "1.0.109"
syn = "2.0"
tide = "0.16.0"
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"
tokio-tungstenite = "0.20"
typenum = "1.16.0"
uhlc = { version = "0.6.0", default-features = false } # Default features are disabled due to usage in no_std crates
unzip-n = "0.1.2"
Expand Down
22 changes: 18 additions & 4 deletions commons/zenoh-config/src/include.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ where
{
// if include property is present, read the file and remove properites found in file from values
let include_object = if let Some(include_path) = values.get(include_property_name) {
let Some(include_path)= include_path.as_str() else {
bail!("{}.{} : property must have string type", title, include_property_name);
let Some(include_path) = include_path.as_str() else {
bail!(
"{}.{} : property must have string type",
title,
include_property_name
);
};
let include_path_adjusted = Path::new(local_path.as_ref()).join(include_path);
let include_path_canonical = match include_path_adjusted.canonicalize() {
Expand All @@ -92,7 +96,12 @@ where
}

let Some(new_local_path) = include_path_adjusted.parent() else {
bail!("{}.{} : cannot get directory part for '{}' value", title, include_property_name, include_path);
bail!(
"{}.{} : cannot get directory part for '{}' value",
title,
include_property_name,
include_path
);
};
let mut include_object: Value = match deserialize_from_file(&include_path_adjusted) {
Ok(v) => v,
Expand All @@ -105,7 +114,12 @@ where
),
};
let Some(include_values) = include_object.as_object_mut() else {
bail!("{}.{}: included file '{}' must contain an object", title, include_property_name, include_path);
bail!(
"{}.{}: included file '{}' must contain an object",
title,
include_property_name,
include_path
);
};
let include_path = include_path.to_string();
for (k, v) in include_values.iter_mut() {
Expand Down
7 changes: 3 additions & 4 deletions commons/zenoh-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -845,10 +845,9 @@ fn sift_privates(value: &mut serde_json::Value) {
}

fn load_external_plugin_config(title: &str, value: &mut Value) -> ZResult<()> {
let Some(values) = value
.as_object_mut() else {
bail!("{} must be object", title);
};
let Some(values) = value.as_object_mut() else {
bail!("{} must be object", title);
};
recursive_include(title, values, HashSet::new(), "__config__", ".")
}

Expand Down
12 changes: 9 additions & 3 deletions commons/zenoh-keyexpr/src/key_expr/format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ impl<'s, Storage: IKeFormatStorage<'s> + 's> TryFrom<&'s str> for KeFormat<'s, S
i += 1;
}
}
let IterativeConstructor::Complete(storage) = storage else {bail!("Couldn't construct KeFormat because its Storage construction was only partial after adding the last segment.")};
let IterativeConstructor::Complete(storage) = storage else {
bail!("Couldn't construct KeFormat because its Storage construction was only partial after adding the last segment.")
};
let segments = storage.segments();
for i in 0..(segments.len() - 1) {
if segments[(i + 1)..]
Expand Down Expand Up @@ -382,7 +384,9 @@ impl<'s, Storage: IKeFormatStorage<'s>> KeFormatter<'s, Storage> {
pub fn set<S: Display>(&mut self, id: &str, value: S) -> Result<&mut Self, FormatSetError> {
use core::fmt::Write;
let segments = self.format.storage.segments();
let Some(i) = segments.iter().position(|s|s.spec.id() == id) else {return Err(FormatSetError::InvalidId)};
let Some(i) = segments.iter().position(|s| s.spec.id() == id) else {
return Err(FormatSetError::InvalidId);
};
if let Some((start, end)) = self.values.as_ref()[i] {
let end = end.get();
let shift = end - start;
Expand All @@ -398,7 +402,9 @@ impl<'s, Storage: IKeFormatStorage<'s>> KeFormatter<'s, Storage> {
match (|| {
let end = self.buffer.len();
if !(end == start && pattern.as_str() == "**") {
let Ok(ke) = keyexpr::new(&self.buffer[start..end]) else {return Err(())};
let Ok(ke) = keyexpr::new(&self.buffer[start..end]) else {
return Err(());
};
if end > u32::MAX as usize || !pattern.includes(ke) {
return Err(());
}
Expand Down
38 changes: 29 additions & 9 deletions commons/zenoh-keyexpr/src/key_expr/format/parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ pub struct Parsed<'s, Storage: IKeFormatStorage<'s>> {

impl<'s, Storage: IKeFormatStorage<'s>> Parsed<'s, Storage> {
pub fn get(&self, id: &str) -> ZResult<Option<&'s keyexpr>> {
let Some(i) = self.format.storage.segments().iter().position(|s| s.spec.id() == id) else {bail!("{} has no {id} field", self.format)};
let Some(i) = self
.format
.storage
.segments()
.iter()
.position(|s| s.spec.id() == id)
else {
bail!("{} has no {id} field", self.format)
};
Ok(self.results.as_ref()[i])
}
pub fn values(&self) -> &[Option<&'s keyexpr>] {
Expand Down Expand Up @@ -92,10 +100,14 @@ impl<'s, Storage: IKeFormatStorage<'s> + 's> KeFormat<'s, Storage> {
let mut results = self.storage.values_storage(|_| None);
let Some(target) = target.strip_suffix(self.suffix) else {
if !segments.is_empty()
&& segments.iter().all(|s| s.spec.pattern() == "**")
&& self.suffix.as_bytes()[0] == b'/'
&& target == &self.suffix[1..] {
return Ok(Parsed { format: self, results });
&& segments.iter().all(|s| s.spec.pattern() == "**")
&& self.suffix.as_bytes()[0] == b'/'
&& target == &self.suffix[1..]
{
return Ok(Parsed {
format: self,
results,
});
}
bail!("{target} is not included in {self}")
};
Expand All @@ -118,8 +130,12 @@ fn do_parse<'s>(
) -> bool {
debug_assert!(!input.starts_with('/'));
// Parsing is finished if there are no more segments to process AND the input is now empty.
let [segment, segments @ ..] = segments else {return input.is_empty()};
let [result, results @ ..] = results else {unreachable!()};
let [segment, segments @ ..] = segments else {
return input.is_empty();
};
let [result, results @ ..] = results else {
unreachable!()
};
// reset result to None in case of backtracking
*result = None;
// Inspect the pattern: we want to know how many chunks we need to have a chance of inclusion, as well as if we need to worry about double wilds
Expand All @@ -145,7 +161,9 @@ fn do_parse<'s>(
);
}
// Strip the prefix (including the end-/ if the prefix is non-empty)
let Some(input) = input.strip_prefix(prefix) else {return false};
let Some(input) = input.strip_prefix(prefix) else {
return false;
};
let mut chunks = 0;
for i in (0..input.len()).filter(|i| input.as_bytes()[*i] == b'/') {
chunks += 1;
Expand Down Expand Up @@ -190,7 +208,9 @@ fn do_parse_doublewild<'s>(
return false;
}
}
let Some(input) = input.strip_prefix(prefix) else {return false};
let Some(input) = input.strip_prefix(prefix) else {
return false;
};
let input = trim_prefix_slash(input);
let mut chunks = 0;
for i in (0..input.len()).filter(|i| input.as_bytes()[*i] == b'/') {
Expand Down
12 changes: 9 additions & 3 deletions commons/zenoh-keyexpr/src/key_expr/format/support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ pub(crate) struct Spec<'a> {
impl<'a> TryFrom<&'a str> for Spec<'a> {
type Error = Error;
fn try_from(spec: &'a str) -> Result<Self, Self::Error> {
let Some(id_end) = spec.find(':') else {bail!("Spec {spec} didn't contain `:`")};
let Some(id_end) = spec.find(':') else {
bail!("Spec {spec} didn't contain `:`")
};
let pattern_start = id_end + 1;
let pattern_end = spec[pattern_start..].find('#').unwrap_or(u16::MAX as usize);
if pattern_start < spec.len() {
let Ok(id_end) = id_end.try_into() else {bail!("Spec {spec} contains an id longer than {}", u16::MAX)};
let Ok(id_end) = id_end.try_into() else {
bail!("Spec {spec} contains an id longer than {}", u16::MAX)
};
if pattern_end > u16::MAX as usize {
bail!("Spec {spec} contains a pattern longer than {}", u16::MAX)
}
Expand Down Expand Up @@ -218,7 +222,9 @@ impl<'s> IKeFormatStorage<'s> for Vec<Segment<'s>> {
constructor: IterativeConstructor<Self, Self::PartialConstruct, Self::ConstructionError>,
segment: Segment<'s>,
) -> IterativeConstructor<Self, Self::PartialConstruct, Self::ConstructionError> {
let IterativeConstructor::Complete(mut this) = constructor else {unsafe {core::hint::unreachable_unchecked()}};
let IterativeConstructor::Complete(mut this) = constructor else {
unsafe { core::hint::unreachable_unchecked() }
};
this.push(segment);
IterativeConstructor::Complete(this)
}
Expand Down
7 changes: 5 additions & 2 deletions commons/zenoh-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,10 @@ impl syn::parse::Parse for FormatDeclaration {
struct FormatDeclarations(syn::punctuated::Punctuated<FormatDeclaration, syn::Token!(,)>);
impl syn::parse::Parse for FormatDeclarations {
fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
Ok(Self(input.parse_terminated(FormatDeclaration::parse)?))
Ok(Self(input.parse_terminated(
FormatDeclaration::parse,
syn::Token![,],
)?))
}
}

Expand Down Expand Up @@ -260,7 +263,7 @@ impl syn::parse::Parse for FormatUsage {
}
assigns.extend(
input
.parse_terminated::<_, syn::Token!(,)>(syn::Expr::parse)?
.parse_terminated(syn::Expr::parse, syn::Token![,])?
.into_iter()
.map(|a| match a {
syn::Expr::Assign(a) => (*a.left, *a.right),
Expand Down
4 changes: 2 additions & 2 deletions commons/zenoh-shm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ impl SharedMemoryReader {
let base_ptr = shm.as_ptr();
let rc = unsafe { base_ptr.add(info.offset) as *mut ChunkHeaderType };
let rc_ptr = AtomicPtr::<ChunkHeaderType>::new(rc);
let buf = unsafe { base_ptr.add(info.offset + CHUNK_HEADER_SIZE) as *mut u8 };
let buf = unsafe { base_ptr.add(info.offset + CHUNK_HEADER_SIZE) };
let shmb = SharedMemoryBuf {
rc_ptr,
buf: AtomicPtr::new(buf),
Expand Down Expand Up @@ -322,7 +322,7 @@ impl SharedMemoryManager {

let mut free_list = BinaryHeap::new();
let chunk = Chunk {
base_addr: base_ptr as *mut u8,
base_addr: base_ptr,
offset: 0,
size: real_size,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ use async_trait::async_trait;
use rand::Rng;
use rsa::{
pkcs1::{DecodeRsaPrivateKey, DecodeRsaPublicKey},
BigUint, Pkcs1v15Encrypt, PublicKey, PublicKeyParts, RsaPrivateKey, RsaPublicKey,
traits::PublicKeyParts,
BigUint, Pkcs1v15Encrypt, RsaPrivateKey, RsaPublicKey,
};
use std::{collections::HashSet, fmt, ops::Deref, path::Path};
use zenoh_buffers::{
Expand Down
12 changes: 6 additions & 6 deletions plugins/zenoh-plugin-storage-manager/tests/wildcard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ async fn test_wild_card_in_order() {
// expected two entries
let data = get_data(&session, "wild/test/*").await;
assert_eq!(data.len(), 2);
assert!(vec!["wild/test/a", "wild/test/b"].contains(&data[0].key_expr.as_str()));
assert!(vec!["wild/test/a", "wild/test/b"].contains(&data[1].key_expr.as_str()));
assert!(vec!["2", "3"].contains(&format!("{}", data[0].value).as_str()));
assert!(vec!["2", "3"].contains(&format!("{}", data[1].value).as_str()));
assert!(["wild/test/a", "wild/test/b"].contains(&data[0].key_expr.as_str()));
assert!(["wild/test/a", "wild/test/b"].contains(&data[1].key_expr.as_str()));
assert!(["2", "3"].contains(&format!("{}", data[0].value).as_str()));
assert!(["2", "3"].contains(&format!("{}", data[1].value).as_str()));

put_data(
&session,
Expand All @@ -152,8 +152,8 @@ async fn test_wild_card_in_order() {
// expected two entries
let data = get_data(&session, "wild/test/*").await;
assert_eq!(data.len(), 2);
assert!(vec!["wild/test/a", "wild/test/b"].contains(&data[0].key_expr.as_str()));
assert!(vec!["wild/test/a", "wild/test/b"].contains(&data[1].key_expr.as_str()));
assert!(["wild/test/a", "wild/test/b"].contains(&data[0].key_expr.as_str()));
assert!(["wild/test/a", "wild/test/b"].contains(&data[1].key_expr.as_str()));
assert_eq!(format!("{}", data[0].value).as_str(), "4");
assert_eq!(format!("{}", data[1].value).as_str(), "4");

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.71.0"
channel = "1.72.0"

0 comments on commit 8c363d8

Please sign in to comment.