Skip to content

Commit

Permalink
Revert "chore: Bump rust version to nightly-2023-10-23 (databendlabs#…
Browse files Browse the repository at this point in the history
…13392)"

This reverts commit 71661d5.

# Conflicts:
#	src/meta/api/src/lib.rs
#	src/query/storages/hive/hive/src/lib.rs
  • Loading branch information
zhang2014 committed Oct 25, 2023
1 parent a9d4234 commit a1d8c49
Show file tree
Hide file tree
Showing 95 changed files with 282 additions and 270 deletions.
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 rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2023-10-23"
channel = "nightly-2023-06-09"
components = ["rustfmt", "clippy", "rust-src", "miri", "rust-analyzer"]
1 change: 1 addition & 0 deletions src/common/base/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#![feature(thread_id_value)]
#![feature(backtrace_frames)]
#![feature(alloc_error_hook)]
#![feature(return_position_impl_trait_in_trait)]
#![feature(slice_swap_unchecked)]

pub mod base;
Expand Down
2 changes: 1 addition & 1 deletion src/common/base/src/mem_allocator/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ unsafe impl GlobalAlloc for GlobalAllocator {
null_mut()
}
}
Equal => ptr.as_ptr(),
Equal => ptr.as_ptr() as *mut u8,
}
}
}
2 changes: 1 addition & 1 deletion src/common/base/src/mem_allocator/mmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ mod test {
{
length += 1;
}
let slice = unsafe { &*(&uname_release[..length] as *const _) };
let slice = unsafe { &*(&uname_release[..length] as *const _ as *const [u8]) };
let ver = std::str::from_utf8(slice).unwrap();
let version = semver::Version::parse(ver);
assert!(version.is_ok());
Expand Down
10 changes: 5 additions & 5 deletions src/common/hashtable/src/dictionary_string_hashtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ pub struct DictionaryEntry<V> {

impl<V> DictionaryEntry<V> {
pub fn is_zero(&self) -> bool {
#[allow(useless_ptr_null_checks)]
unsafe {
self.key.assume_init_ref().as_ptr().is_null()
}
unsafe { self.key.assume_init_ref().as_ptr().is_null() }
}
}

Expand Down Expand Up @@ -447,7 +444,10 @@ impl<'a, V> Clone for DictionaryEntryRef<'a, V>
where Self: 'a
{
fn clone(&self) -> Self {
*self
DictionaryEntryRef {
key: self.key,
entry: self.entry,
}
}
}

Expand Down
13 changes: 10 additions & 3 deletions src/common/hashtable/src/short_string_hashtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,14 @@ impl<'a, K: ?Sized, V> Copy for ShortStringHashtableEntryRefInner<'a, K, V> {}

impl<'a, K: ?Sized, V> Clone for ShortStringHashtableEntryRefInner<'a, K, V> {
fn clone(&self) -> Self {
*self
use ShortStringHashtableEntryRefInner::*;
match self {
Table0(a, b) => Table0(a, *b),
Table1(a) => Table1(a),
Table2(a) => Table2(a),
Table3(a) => Table3(a),
Table4(a) => Table4(a),
}
}
}

Expand Down Expand Up @@ -511,7 +518,7 @@ impl<'a, K: ?Sized, V> Copy for ShortStringHashtableEntryRef<'a, K, V> {}

impl<'a, K: ?Sized, V> Clone for ShortStringHashtableEntryRef<'a, K, V> {
fn clone(&self) -> Self {
*self
Self(self.0)
}
}

Expand Down Expand Up @@ -920,7 +927,7 @@ where A: Allocator + Clone + Default

fn get_mut(&mut self, key: &Self::Key) -> Option<&mut Self::Value> {
self.entry_mut(key)
.map(|e| unsafe { &mut *(e.get_mut_ptr()) })
.map(|e| unsafe { &mut *(e.get_mut_ptr() as *mut V) })
}

unsafe fn insert(
Expand Down
10 changes: 7 additions & 3 deletions src/common/hashtable/src/string_hashtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,11 @@ impl<'a, K: ?Sized, V> Copy for StringHashtableEntryRefInner<'a, K, V> {}

impl<'a, K: ?Sized, V> Clone for StringHashtableEntryRefInner<'a, K, V> {
fn clone(&self) -> Self {
*self
use StringHashtableEntryRefInner::*;
match self {
TableEmpty(a, b) => TableEmpty(a, *b),
Table(a) => Table(a),
}
}
}

Expand Down Expand Up @@ -317,7 +321,7 @@ impl<'a, K: ?Sized, V> Copy for StringHashtableEntryRef<'a, K, V> {}

impl<'a, K: ?Sized, V> Clone for StringHashtableEntryRef<'a, K, V> {
fn clone(&self) -> Self {
*self
Self(self.0)
}
}

Expand Down Expand Up @@ -510,7 +514,7 @@ where A: Allocator + Clone + Default

fn get_mut(&mut self, key: &Self::Key) -> Option<&mut Self::Value> {
self.entry_mut(key)
.map(|e| unsafe { &mut *(e.get_mut_ptr()) })
.map(|e| unsafe { &mut *(e.get_mut_ptr() as *mut V) })
}

unsafe fn insert(
Expand Down
2 changes: 0 additions & 2 deletions src/common/hashtable/tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![allow(clippy::arc_with_non_send_sync)]

use std::ptr::NonNull;
use std::sync::atomic::AtomicUsize;
use std::sync::atomic::Ordering;
Expand Down
2 changes: 1 addition & 1 deletion src/common/openai/src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl OpenAI {
} else {
let message = resp
.choices
.first()
.get(0)
.and_then(|choice| choice.message.as_ref());

match message {
Expand Down
1 change: 1 addition & 0 deletions src/common/storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
//! - Intermediate data generated by query could be stored by temporary operator.
#![allow(clippy::uninlined_format_args)]
#![feature(io_error_other)]

mod config;
pub use config::ShareTableConfig;
Expand Down
2 changes: 1 addition & 1 deletion src/common/storage/tests/it/column_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn test_column_leaf_schema_from_struct() -> Result<()> {
let column_6_ids = vec![9];
let column_7_ids = vec![10];
let column_8_ids = vec![11, 12];
let expected_column_ids = [
let expected_column_ids = vec![
("u64", &column_1_ids),
("tuplearray", &column_2_ids),
("arraytuple", &column_3_ids),
Expand Down
2 changes: 1 addition & 1 deletion src/meta/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

#![allow(clippy::uninlined_format_args)]
#![allow(clippy::diverging_sub_expression)]
#![deny(unused_crate_dependencies)]
extern crate common_meta_types;

mod background_api;
Expand Down
4 changes: 2 additions & 2 deletions src/meta/api/src/schema_api_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,7 @@ impl<KV: kvapi::KVApi<Error = MetaError> + ?Sized> SchemaApi for KV {
debug!("SchemaApi: {}", func_name!());

let reply = self
.prefix_list_kv(&[TableId::PREFIX, ""].join("/"))
.prefix_list_kv(&vec![TableId::PREFIX, ""].join("/"))
.await?;

let mut res = vec![];
Expand Down Expand Up @@ -2799,7 +2799,7 @@ impl<KV: kvapi::KVApi<Error = MetaError> + ?Sized> SchemaApi for KV {
});
} else {
let resp = responses
.first()
.get(0)
// fail fast if response is None (which should not happen)
.expect("internal error: expect one response if update_table_meta txn failed.");

Expand Down
8 changes: 4 additions & 4 deletions src/meta/api/src/schema_api_test_suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,8 @@ impl SchemaApiTestSuite {
async fn database_list<MT: SchemaApi>(&self, mt: &MT) -> anyhow::Result<()> {
info!("--- prepare db1 and db2");
let mut db_ids = vec![];
let db_names = ["db1", "db2"];
let engines = ["eng1", "eng2"];
let db_names = vec!["db1", "db2"];
let engines = vec!["eng1", "eng2"];
let tenant = "tenant1";
{
let res = self.create_database(mt, tenant, "db1", "eng1").await?;
Expand Down Expand Up @@ -3772,7 +3772,7 @@ impl SchemaApiTestSuite {
let resp = mt.get_drop_table_infos(req).await?;
assert_eq!(resp.drop_ids, drop_ids_1);

let expected: BTreeSet<String> = [
let expected: BTreeSet<String> = vec![
"'tenant1'.'db1'.'tb1'".to_string(),
"'tenant1'.'db2'.'tb1'".to_string(),
"'tenant1'.'db3'.'tb1'".to_string(),
Expand Down Expand Up @@ -3800,7 +3800,7 @@ impl SchemaApiTestSuite {
let resp = mt.get_drop_table_infos(req).await?;
assert_eq!(resp.drop_ids, drop_ids_2);

let expected: BTreeSet<String> = [
let expected: BTreeSet<String> = vec![
"'tenant1'.'db1'.'tb1'".to_string(),
"'tenant1'.'db2'.'tb1'".to_string(),
"'tenant1'.'db2'.'tb2'".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion src/meta/app/src/principal/user_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl AuthType {
}

fn bad_auth_types(s: &str) -> String {
let all = [
let all = vec![
NO_PASSWORD_STR,
SHA256_PASSWORD_STR,
DOUBLE_SHA1_PASSWORD_STR,
Expand Down
2 changes: 1 addition & 1 deletion src/meta/app/src/share/share.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ impl ShareMeta {
}

pub fn get_accounts(&self) -> Vec<String> {
Vec::<String>::from_iter(self.accounts.clone())
Vec::<String>::from_iter(self.accounts.clone().into_iter())
}

pub fn has_account(&self, account: &String) -> bool {
Expand Down
1 change: 0 additions & 1 deletion src/meta/client/tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![allow(clippy::uninlined_format_args)]
#![allow(clippy::diverging_sub_expression)]

mod grpc_client;
mod grpc_server;
Expand Down
2 changes: 0 additions & 2 deletions src/meta/embedded/tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![allow(clippy::diverging_sub_expression)]

mod kv_api_impl;
mod schema_api_impl;
4 changes: 2 additions & 2 deletions src/meta/kvapi/src/kvapi/test_suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ impl kvapi::TestSuite {

// test again with if condition
{
let txn_key = unmatch_keys.first().unwrap().to_string();
let txn_key = unmatch_keys.get(0).unwrap().to_string();
let condition = vec![TxnCondition {
key: txn_key.clone(),
expected: ConditionResult::Gt as i32,
Expand Down Expand Up @@ -601,7 +601,7 @@ impl kvapi::TestSuite {
// test again with else condition
{
let txn_key = "unmatch_keys".to_string();
let unmatch_prefix = unmatch_keys.first().unwrap().to_string();
let unmatch_prefix = unmatch_keys.get(0).unwrap().to_string();
let condition = vec![TxnCondition {
key: txn_key.clone(),
expected: ConditionResult::Gt as i32,
Expand Down
4 changes: 2 additions & 2 deletions src/meta/proto-conv/src/database_from_to_protobuf_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl FromToProto for mt::DatabaseMeta {
None => None,
},
comment: p.comment,
shared_by: BTreeSet::from_iter(p.shared_by),
shared_by: BTreeSet::from_iter(p.shared_by.into_iter()),
from_share: match p.from_share {
Some(from_share) => Some(share::ShareNameIdent::from_pb(from_share)?),
None => None,
Expand All @@ -101,7 +101,7 @@ impl FromToProto for mt::DatabaseMeta {
None => None,
},
comment: self.comment.clone(),
shared_by: Vec::from_iter(self.shared_by.clone()),
shared_by: Vec::from_iter(self.shared_by.clone().into_iter()),
from_share: match &self.from_share {
Some(from_share) => Some(from_share.to_pb()?),
None => None,
Expand Down
8 changes: 4 additions & 4 deletions src/meta/proto-conv/src/share_from_to_protobuf_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ impl FromToProto for mt::ShareMeta {
},
entries,
comment: p.comment.clone(),
accounts: BTreeSet::from_iter(p.accounts.clone()),
share_from_db_ids: BTreeSet::from_iter(p.share_from_db_ids.clone()),
accounts: BTreeSet::from_iter(p.accounts.clone().into_iter()),
share_from_db_ids: BTreeSet::from_iter(p.share_from_db_ids.clone().into_iter()),
share_on: DateTime::<Utc>::from_pb(p.share_on)?,
update_on: match p.update_on {
Some(t) => Some(DateTime::<Utc>::from_pb(t)?),
Expand All @@ -207,8 +207,8 @@ impl FromToProto for mt::ShareMeta {
None => None,
},
entries,
accounts: Vec::from_iter(self.accounts.clone()),
share_from_db_ids: Vec::from_iter(self.share_from_db_ids.clone()),
accounts: Vec::from_iter(self.accounts.clone().into_iter()),
share_from_db_ids: Vec::from_iter(self.share_from_db_ids.clone().into_iter()),
comment: self.comment.clone(),
share_on: self.share_on.to_pb()?,
update_on: match &self.update_on {
Expand Down
7 changes: 4 additions & 3 deletions src/meta/proto-conv/src/table_from_to_protobuf_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
//! This mod is the key point about compatibility.
//! Everytime update anything in this file, update the `VER` and let the tests pass.
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::sync::Arc;

Expand Down Expand Up @@ -212,7 +213,7 @@ impl FromToProto for mt::TableMeta {
.map(mt::TableStatistics::from_pb)
.transpose()?
.unwrap_or_default(),
shared_by: BTreeSet::from_iter(p.shared_by),
shared_by: BTreeSet::from_iter(p.shared_by.into_iter()),
column_mask_policy: if p.column_mask_policy.is_empty() {
None
} else {
Expand Down Expand Up @@ -256,8 +257,8 @@ impl FromToProto for mt::TableMeta {
comment: self.comment.clone(),
field_comments: self.field_comments.clone(),
statistics: Some(self.statistics.to_pb()?),
shared_by: Vec::from_iter(self.shared_by.clone()),
column_mask_policy: self.column_mask_policy.clone().unwrap_or_default(),
shared_by: Vec::from_iter(self.shared_by.clone().into_iter()),
column_mask_policy: self.column_mask_policy.clone().unwrap_or(BTreeMap::new()),
owner: match self.owner.as_ref() {
Some(o) => Some(o.to_pb()?),
None => None,
Expand Down
Loading

0 comments on commit a1d8c49

Please sign in to comment.