Skip to content

Commit

Permalink
treewide: Update Rust toolchain to 2024-05-02
Browse files Browse the repository at this point in the history
Change-Id: I56ea0995b899ce657b47bb42c6d2bef219db2516
  • Loading branch information
ethowitz committed May 3, 2024
1 parent 18044db commit 0fcc040
Show file tree
Hide file tree
Showing 61 changed files with 260 additions and 376 deletions.
File renamed without changes.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ rocksdb = { git = "https://github.com/readysettech/rust-rocksdb.git", default-fe
metrics-exporter-prometheus = { git = "https://github.com/readysettech/metrics.git" }
metrics = { git = "https://github.com/readysettech/metrics.git" }
metrics-util = { git = "https://github.com/readysettech/metrics.git" }
ahash = "0.7"
ahash = "0.8"
anyhow = "1.0.82"
assert_approx_eq = "1.1.0"
assert_unordered = "0.3"
Expand Down
1 change: 0 additions & 1 deletion array2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#![feature(int_roundings)]
use std::fmt::Debug;
use std::ops::{Index, IndexMut};
use std::usize;

use serde::{Deserialize, Serialize};
use thiserror::Error;
Expand Down
2 changes: 0 additions & 2 deletions benchmarks/src/reporting/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@ impl AnalysisInfo {

#[derive(Debug)]
pub struct Stats {
pub samples: i64,
pub mean: f64,
pub stdev: f64,
}

impl Stats {
pub fn with(hist: &hdrhistogram::Histogram<u64>) -> Stats {
Stats {
samples: hist.len() as i64,
mean: hist.mean(),
stdev: hist.stdev(),
}
Expand Down
1 change: 0 additions & 1 deletion benchmarks/src/reporting/storage/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ struct Data {
impl Data {
fn to_stats(&self) -> Stats {
Stats {
samples: self.samples as i64,
mean: self.mean,
stdev: self.stdev,
}
Expand Down
1 change: 0 additions & 1 deletion benchmarks/src/reporting/storage/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ impl Storage for PostgresStorage {
None
}
[row, ..] => Some(Stats {
samples: row.get(0),
mean: row.get(1),
stdev: row.get(2),
}),
Expand Down
2 changes: 1 addition & 1 deletion dataflow-state/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(stmt_expr_attributes, bound_map, iter_order_by, bound_as_ref)]
#![feature(stmt_expr_attributes, iter_order_by, bound_as_ref)]

mod key;
mod keyed_state;
Expand Down
3 changes: 3 additions & 0 deletions mysql-srv/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ use crate::myc::constants::{CapabilityFlags, Command as CommandByte, UTF8MB4_GEN
#[derive(Debug)]
pub struct ClientHandshake<'a> {
pub capabilities: CapabilityFlags,
#[allow(dead_code)]
pub maxps: u32,
#[allow(dead_code)]
pub charset: u16,
pub username: &'a str,
pub password: &'a [u8],
Expand All @@ -24,6 +26,7 @@ pub struct ClientChangeUser<'a> {
pub username: &'a str,
pub password: &'a [u8],
pub database: Option<&'a str>,
#[allow(dead_code)]
pub charset: u16,
pub auth_plugin_name: &'a str,
}
Expand Down
52 changes: 8 additions & 44 deletions mysql-srv/src/value/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,59 +456,23 @@ mod tests {
);*/
rt!(f64_one, f64, 1.0, ColumnType::MYSQL_TYPE_DOUBLE, false);

rt!(
u8_max,
u8,
u8::max_value(),
ColumnType::MYSQL_TYPE_TINY,
false
);
rt!(
i8_max,
i8,
i8::max_value(),
ColumnType::MYSQL_TYPE_TINY,
true
);
rt!(
u16_max,
u16,
u16::max_value(),
ColumnType::MYSQL_TYPE_SHORT,
false
);
rt!(
i16_max,
i16,
i16::max_value(),
ColumnType::MYSQL_TYPE_SHORT,
true
);
rt!(
u32_max,
u32,
u32::max_value(),
ColumnType::MYSQL_TYPE_LONG,
false
);
rt!(
i32_max,
i32,
i32::max_value(),
ColumnType::MYSQL_TYPE_LONG,
true
);
rt!(u8_max, u8, u8::MAX, ColumnType::MYSQL_TYPE_TINY, false);
rt!(i8_max, i8, i8::MAX, ColumnType::MYSQL_TYPE_TINY, true);
rt!(u16_max, u16, u16::MAX, ColumnType::MYSQL_TYPE_SHORT, false);
rt!(i16_max, i16, i16::MAX, ColumnType::MYSQL_TYPE_SHORT, true);
rt!(u32_max, u32, u32::MAX, ColumnType::MYSQL_TYPE_LONG, false);
rt!(i32_max, i32, i32::MAX, ColumnType::MYSQL_TYPE_LONG, true);
rt!(
u64_max,
u64,
u64::max_value(),
u64::MAX,
ColumnType::MYSQL_TYPE_LONGLONG,
false
);
rt!(
i64_max,
i64,
i64::max_value(),
i64::MAX,
ColumnType::MYSQL_TYPE_LONGLONG,
true
);
Expand Down
90 changes: 27 additions & 63 deletions mysql-srv/src/value/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@ where
// NOTE: yes, I know the = / => distinction is ugly
macro_rules! like_try_into {
($self:ident, $source:ty = $target:ty, $w:ident, $m:ident, $c:ident) => {{
let min = <$target>::min_value() as $source;
let max = <$target>::max_value() as $source;
let min = <$target>::MIN as $source;
let max = <$target>::MAX as $source;
if *$self <= max && *$self >= min {
$w.$m(*$self as $target)
} else {
Err(bad($self, $c))
}
}};
($self:ident, $source:ty => $target:ty, $w:ident, $m:ident, $c:ident) => {{
let min = <$target>::min_value() as $source;
let max = <$target>::max_value() as $source;
let min = <$target>::MIN as $source;
let max = <$target>::MAX as $source;
if *$self <= max && *$self >= min {
$w.$m::<LittleEndian>(*$self as $target)
} else {
Expand Down Expand Up @@ -684,25 +684,25 @@ impl ToMySqlValue for myc::value::Value {
// smallest containing type, and then call on that
let signed = !c.colflags.contains(ColumnFlags::UNSIGNED_FLAG);
if signed {
if n >= i64::from(i8::min_value()) && n <= i64::from(i8::max_value()) {
if n >= i64::from(i8::MIN) && n <= i64::from(i8::MAX) {
(n as i8).to_mysql_bin(w, c)
} else if n >= i64::from(i16::min_value()) && n <= i64::from(i16::max_value()) {
} else if n >= i64::from(i16::MIN) && n <= i64::from(i16::MAX) {
(n as i16).to_mysql_bin(w, c)
} else if n >= i64::from(i32::min_value()) && n <= i64::from(i32::max_value()) {
} else if n >= i64::from(i32::MIN) && n <= i64::from(i32::MAX) {
(n as i32).to_mysql_bin(w, c)
} else {
n.to_mysql_bin(w, c)
}
} else if n < 0 {
Err(bad(self, c))
} else if n <= i64::from(u8::max_value()) {
} else if n <= i64::from(u8::MAX) {
(n as u8).to_mysql_bin(w, c)
} else if n <= i64::from(u16::max_value()) {
} else if n <= i64::from(u16::MAX) {
(n as u16).to_mysql_bin(w, c)
} else if n <= i64::from(u32::max_value()) {
} else if n <= i64::from(u32::MAX) {
(n as u32).to_mysql_bin(w, c)
} else {
// must work since u64::max_value() > i64::max_value(), and n >= 0
// must work since u64::MAX > i64::MAX, and n >= 0
(n as u64).to_mysql_bin(w, c)
}
}
Expand Down Expand Up @@ -793,14 +793,14 @@ mod tests {
rt!(f32_one, f32, 1.0);
rt!(f64_one, f64, 1.0);

rt!(u8_max, u8, u8::max_value());
rt!(i8_max, i8, i8::max_value());
rt!(u16_max, u16, u16::max_value());
rt!(i16_max, i16, i16::max_value());
rt!(u32_max, u32, u32::max_value());
rt!(i32_max, i32, i32::max_value());
rt!(u64_max, u64, u64::max_value());
rt!(i64_max, i64, i64::max_value());
rt!(u8_max, u8, u8::MAX);
rt!(i8_max, i8, i8::MAX);
rt!(u16_max, u16, u16::MAX);
rt!(i16_max, i16, i16::MAX);
rt!(u32_max, u32, u32::MAX);
rt!(i32_max, i32, i32::MAX);
rt!(u64_max, u64, u64::MAX);
rt!(i64_max, i64, i64::MAX);

rt!(opt_none, Option<u8>, None);
rt!(opt_some, Option<u8>, Some(1));
Expand Down Expand Up @@ -927,59 +927,23 @@ mod tests {
);*/
rt!(f64_one, f64, 1.0, ColumnType::MYSQL_TYPE_DOUBLE, false);

rt!(
u8_max,
u8,
u8::max_value(),
ColumnType::MYSQL_TYPE_TINY,
false
);
rt!(
i8_max,
i8,
i8::max_value(),
ColumnType::MYSQL_TYPE_TINY,
true
);
rt!(
u16_max,
u16,
u16::max_value(),
ColumnType::MYSQL_TYPE_SHORT,
false
);
rt!(
i16_max,
i16,
i16::max_value(),
ColumnType::MYSQL_TYPE_SHORT,
true
);
rt!(
u32_max,
u32,
u32::max_value(),
ColumnType::MYSQL_TYPE_LONG,
false
);
rt!(
i32_max,
i32,
i32::max_value(),
ColumnType::MYSQL_TYPE_LONG,
true
);
rt!(u8_max, u8, u8::MAX, ColumnType::MYSQL_TYPE_TINY, false);
rt!(i8_max, i8, i8::MAX, ColumnType::MYSQL_TYPE_TINY, true);
rt!(u16_max, u16, u16::MAX, ColumnType::MYSQL_TYPE_SHORT, false);
rt!(i16_max, i16, i16::MAX, ColumnType::MYSQL_TYPE_SHORT, true);
rt!(u32_max, u32, u32::MAX, ColumnType::MYSQL_TYPE_LONG, false);
rt!(i32_max, i32, i32::MAX, ColumnType::MYSQL_TYPE_LONG, true);
rt!(
u64_max,
u64,
u64::max_value(),
u64::MAX,
ColumnType::MYSQL_TYPE_LONGLONG,
false
);
rt!(
i64_max,
i64,
i64::max_value(),
i64::MAX,
ColumnType::MYSQL_TYPE_LONGLONG,
true
);
Expand Down
Loading

0 comments on commit 0fcc040

Please sign in to comment.