From 66175998b0795bd52fb34d8e6f8f37cc215e9ed6 Mon Sep 17 00:00:00 2001 From: Ethan Donowitz Date: Wed, 24 Apr 2024 17:46:41 -0400 Subject: [PATCH] Revert "treewide: Bump rust version to nightly-2023-12-28" This reverts commit 4317d95a34046f9796330a67f05b8dca5554ffd7. Change-Id: Idc6e6952f2a3cd027f4c58082ac770571d3f1cbc Reviewed-on: https://gerrit.readyset.name/c/readyset/+/7388 Tested-by: Buildkite CI Reviewed-by: Ron Hough --- array2/src/lib.rs | 22 +++++++++---------- nom-sql/src/sql_identifier.rs | 6 +++++ readyset-alloc/src/lib.rs | 1 - readyset-clustertest/src/readyset_mysql.rs | 2 +- readyset-mir/src/graph.rs | 10 +++++---- readyset-tracing/src/lib.rs | 1 + replicators/src/mysql_connector/snapshot.rs | 14 +++++------- .../src/postgres_connector/snapshot.rs | 14 +++++------- rust-toolchain | 2 +- 9 files changed, 38 insertions(+), 34 deletions(-) diff --git a/array2/src/lib.rs b/array2/src/lib.rs index 8ec5b6fce5..e8e76a8d67 100644 --- a/array2/src/lib.rs +++ b/array2/src/lib.rs @@ -20,8 +20,9 @@ //! Internally, values are stored in a single continuous allocation row-first, alongside the length //! of the row. -#![feature(int_roundings)] +#![feature(core_intrinsics, int_roundings)] use std::fmt::Debug; +use std::intrinsics::unlikely; use std::ops::{Index, IndexMut}; use std::usize; @@ -84,16 +85,11 @@ impl Array2 { /// passed an empty vector or if the rows are a different size. #[inline] pub fn try_from_rows(rows: Vec>) -> Result { - #[cold] - fn not_equal(x: usize, y: usize) -> bool { - x != y - } - let row_size = rows.first().ok_or(Error::Empty)?.len(); let mut elems = Vec::with_capacity(row_size * rows.len()); for (row_index, row) in rows.into_iter().enumerate() { - if not_equal(row.len(), row_size) { + if unlikely(row.len() != row_size) { return Err(Error::InconsistentRowSize { row_index, row_size, @@ -203,7 +199,9 @@ impl Array2 { /// ); /// ``` #[inline] - pub fn rows(&self) -> impl ExactSizeIterator + DoubleEndedIterator + '_ { + pub fn rows( + &self, + ) -> impl Iterator + ExactSizeIterator + DoubleEndedIterator + '_ { self.cells.chunks(self.row_size) } @@ -222,7 +220,7 @@ impl Array2 { /// ) /// ``` #[inline] - pub fn entries(&self) -> impl ExactSizeIterator + '_ { + pub fn entries(&self) -> impl Iterator + ExactSizeIterator + '_ { self.cells.iter().enumerate().map(move |(i, v)| { let row = i.div_floor(self.row_size); let col = i % self.row_size; @@ -245,7 +243,9 @@ impl Array2 { /// assert_eq!(my_array2, Array2::from_rows(vec![vec![1, 3], vec![4, 6]])) /// ``` #[inline] - pub fn entries_mut(&mut self) -> impl ExactSizeIterator + '_ { + pub fn entries_mut( + &mut self, + ) -> impl Iterator + ExactSizeIterator + '_ { let row_size = self.row_size; self.cells.iter_mut().enumerate().map(move |(i, v)| { let row = i.div_floor(row_size); @@ -270,7 +270,7 @@ impl Array2 { /// ) /// ``` #[inline] - pub fn into_entries(self) -> impl ExactSizeIterator { + pub fn into_entries(self) -> impl Iterator + ExactSizeIterator { self.cells .into_vec() .into_iter() diff --git a/nom-sql/src/sql_identifier.rs b/nom-sql/src/sql_identifier.rs index 5b7bd4002b..36038b26ac 100644 --- a/nom-sql/src/sql_identifier.rs +++ b/nom-sql/src/sql_identifier.rs @@ -307,6 +307,12 @@ impl std::borrow::Borrow for SqlIdentifier { } } +impl std::borrow::Borrow<[u8]> for SqlIdentifier { + fn borrow(&self) -> &[u8] { + self.as_ref() + } +} + impl PartialOrd for SqlIdentifier { #[inline] #[allow(clippy::non_canonical_partial_ord_impl)] diff --git a/readyset-alloc/src/lib.rs b/readyset-alloc/src/lib.rs index 747429a50d..66baa0f72e 100644 --- a/readyset-alloc/src/lib.rs +++ b/readyset-alloc/src/lib.rs @@ -59,7 +59,6 @@ #![cfg_attr(test, feature(test))] #![cfg_attr(test, feature(custom_test_frameworks))] #![cfg_attr(test, test_runner(runner::run_env_conditional_tests))] -#![allow(internal_features)] #![feature(core_intrinsics)] #[macro_use] diff --git a/readyset-clustertest/src/readyset_mysql.rs b/readyset-clustertest/src/readyset_mysql.rs index e7814681bd..9406afda8e 100644 --- a/readyset-clustertest/src/readyset_mysql.rs +++ b/readyset-clustertest/src/readyset_mysql.rs @@ -1599,7 +1599,7 @@ async fn views_synchronize_between_deployments() { // Eventually it should show up in adapter 1 too eventually! { - adapter_1.as_mysql_conn().unwrap().query_drop("SELECT * FROM t1;").await.unwrap(); + adapter_1.as_mysql_conn().unwrap().query_drop("SELECT * FROM t1;"); last_statement_destination(adapter_1.as_mysql_conn().unwrap()).await == QueryDestination::Readyset } diff --git a/readyset-mir/src/graph.rs b/readyset-mir/src/graph.rs index d55fd59371..4c001cc191 100644 --- a/readyset-mir/src/graph.rs +++ b/readyset-mir/src/graph.rs @@ -378,10 +378,12 @@ impl MirGraph { }, // otherwise, just look up in the column set // Compare by name if there is no table - _ => match if c.table.is_none() { - self.columns(node).iter().position(|cc| cc.name == c.name) - } else { - self.columns(node).iter().position(|cc| cc == c) + _ => match { + if c.table.is_none() { + self.columns(node).iter().position(|cc| cc.name == c.name) + } else { + self.columns(node).iter().position(|cc| cc == c) + } } { Some(id) => Ok(id), None => err, diff --git a/readyset-tracing/src/lib.rs b/readyset-tracing/src/lib.rs index 5170c72b59..7e5f1a25ae 100644 --- a/readyset-tracing/src/lib.rs +++ b/readyset-tracing/src/lib.rs @@ -15,6 +15,7 @@ //! [presampling](presampled) - sampling spans at creation time rather than when a subscriber would //! send them to a collector. +#![feature(core_intrinsics)] use std::fs::File; use std::path::{Path, PathBuf}; use std::sync::Arc; diff --git a/replicators/src/mysql_connector/snapshot.rs b/replicators/src/mysql_connector/snapshot.rs index cb5bfa5498..89f0ac2199 100644 --- a/replicators/src/mysql_connector/snapshot.rs +++ b/replicators/src/mysql_connector/snapshot.rs @@ -204,7 +204,7 @@ impl MySqlReplicator { let mut bad_tables = Vec::new(); // Process `CREATE TABLE` statements for (db, table) in replicated_tables.iter() { - let res = create_for_table(&mut tx, db, table, TableKind::BaseTable) + match create_for_table(&mut tx, db, table, TableKind::BaseTable) .map_err(|e| e.into()) .and_then(|create_table| { debug!(%create_table, "Extending recipe"); @@ -222,9 +222,8 @@ impl MySqlReplicator { changelist.with_schema_search_path(vec![db.clone().into()]), ) }) - .await; - - match res { + .await + { Ok(_) => {} Err(error) => { warn!(%error, "Error extending CREATE TABLE, table will not be used"); @@ -257,7 +256,7 @@ impl MySqlReplicator { // Process `CREATE VIEW` statements for (db, view) in all_views.iter() { - let res = create_for_table(&mut tx, db, view, TableKind::View) + match create_for_table(&mut tx, db, view, TableKind::View) .map_err(|e| e.into()) .and_then(|create_view| { db_schemas.extend_create_schema_for_view( @@ -273,9 +272,8 @@ impl MySqlReplicator { changelist.with_schema_search_path(vec![db.clone().into()]), ) }) - .await; - - match res { + .await + { Ok(_) => {} Err(error) => { warn!(%view, %error, "Error extending CREATE VIEW, view will not be used"); diff --git a/replicators/src/postgres_connector/snapshot.rs b/replicators/src/postgres_connector/snapshot.rs index 70b2c05c47..d2c822a405 100644 --- a/replicators/src/postgres_connector/snapshot.rs +++ b/replicators/src/postgres_connector/snapshot.rs @@ -774,7 +774,7 @@ impl<'a> PostgresReplicator<'a> { let mut tables = Vec::with_capacity(table_list.len()); for table in table_list { let table_name = &table.name.clone().to_string(); - let res = table + match table .get_table(get_transaction!(self)) .and_then(|create_table| { future::ready( @@ -809,9 +809,8 @@ impl<'a> PostgresReplicator<'a> { )) .map_ok(|_| create_table) }) - .await; - - match res { + .await + { Ok(create_table) => { tables.push(create_table); } @@ -837,7 +836,7 @@ impl<'a> PostgresReplicator<'a> { let view_name = view.name.clone(); let view_schema = view.schema.clone(); - let res = view + match view .get_create_view(get_transaction!(self)) .map_err(|e| e.into()) .and_then(|create_view| { @@ -857,9 +856,8 @@ impl<'a> PostgresReplicator<'a> { .with_schema_search_path(vec![view_schema.clone().into()]), ) }) - .await; - - match res { + .await + { Ok(_) => {} Err(error) => { warn!( diff --git a/rust-toolchain b/rust-toolchain index 0e2ac63c79..fac9292f1d 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2023-12-28 +nightly-2023-11-09