Skip to content

chore: Bump rust version to nightly-2023-10-23 #13392

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

Merged
merged 6 commits into from
Oct 23, 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
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-06-09"
channel = "nightly-2023-10-23"
components = ["rustfmt", "clippy", "rust-src", "miri", "rust-analyzer"]
1 change: 0 additions & 1 deletion src/common/base/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#![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() as *mut u8,
Equal => ptr.as_ptr(),
}
}
}
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 _ as *const [u8]) };
let slice = unsafe { &*(&uname_release[..length] as *const _) };
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,7 +84,10 @@ pub struct DictionaryEntry<V> {

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

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

Expand Down
13 changes: 3 additions & 10 deletions src/common/hashtable/src/short_string_hashtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,7 @@ 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 {
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),
}
*self
}
}

Expand Down Expand Up @@ -518,7 +511,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.0)
*self
}
}

Expand Down Expand Up @@ -927,7 +920,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() as *mut V) })
.map(|e| unsafe { &mut *(e.get_mut_ptr()) })
}

unsafe fn insert(
Expand Down
10 changes: 3 additions & 7 deletions src/common/hashtable/src/string_hashtable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,7 @@ 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 {
use StringHashtableEntryRefInner::*;
match self {
TableEmpty(a, b) => TableEmpty(a, *b),
Table(a) => Table(a),
}
*self
}
}

Expand Down Expand Up @@ -321,7 +317,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.0)
*self
}
}

Expand Down Expand Up @@ -514,7 +510,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() as *mut V) })
.map(|e| unsafe { &mut *(e.get_mut_ptr()) })
}

unsafe fn insert(
Expand Down
2 changes: 2 additions & 0 deletions src/common/hashtable/tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// 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
.get(0)
.first()
.and_then(|choice| choice.message.as_ref());

match message {
Expand Down
1 change: 0 additions & 1 deletion src/common/storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
//! - 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 = vec![
let expected_column_ids = [
("u64", &column_1_ids),
("tuplearray", &column_2_ids),
("arraytuple", &column_3_ids),
Expand Down
1 change: 1 addition & 0 deletions src/meta/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#![allow(clippy::uninlined_format_args)]
#![deny(unused_crate_dependencies)]
#![allow(clippy::diverging_sub_expression)]
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 @@ -1643,7 +1643,7 @@ impl<KV: kvapi::KVApi<Error = MetaError> + ?Sized> SchemaApi for KV {
debug!("SchemaApi: {}", func_name!());

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

let mut res = vec![];
Expand Down Expand Up @@ -2794,7 +2794,7 @@ impl<KV: kvapi::KVApi<Error = MetaError> + ?Sized> SchemaApi for KV {
});
} else {
let resp = responses
.get(0)
.first()
// 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 = vec!["db1", "db2"];
let engines = vec!["eng1", "eng2"];
let db_names = ["db1", "db2"];
let engines = ["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> = vec![
let expected: BTreeSet<String> = [
"'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> = vec![
let expected: BTreeSet<String> = [
"'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 = vec![
let all = [
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().into_iter())
Vec::<String>::from_iter(self.accounts.clone())
}

pub fn has_account(&self, account: &String) -> bool {
Expand Down
1 change: 1 addition & 0 deletions src/meta/client/tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// 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: 2 additions & 0 deletions src/meta/embedded/tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@
// 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 @@ -554,7 +554,7 @@ impl kvapi::TestSuite {

// test again with if condition
{
let txn_key = unmatch_keys.get(0).unwrap().to_string();
let txn_key = unmatch_keys.first().unwrap().to_string();
let condition = vec![TxnCondition {
key: txn_key.clone(),
expected: ConditionResult::Gt as i32,
Expand Down Expand Up @@ -600,7 +600,7 @@ impl kvapi::TestSuite {
// test again with else condition
{
let txn_key = "unmatch_keys".to_string();
let unmatch_prefix = unmatch_keys.get(0).unwrap().to_string();
let unmatch_prefix = unmatch_keys.first().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.into_iter()),
shared_by: BTreeSet::from_iter(p.shared_by),
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().into_iter()),
shared_by: Vec::from_iter(self.shared_by.clone()),
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().into_iter()),
share_from_db_ids: BTreeSet::from_iter(p.share_from_db_ids.clone().into_iter()),
accounts: BTreeSet::from_iter(p.accounts.clone()),
share_from_db_ids: BTreeSet::from_iter(p.share_from_db_ids.clone()),
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().into_iter()),
share_from_db_ids: Vec::from_iter(self.share_from_db_ids.clone().into_iter()),
accounts: Vec::from_iter(self.accounts.clone()),
share_from_db_ids: Vec::from_iter(self.share_from_db_ids.clone()),
comment: self.comment.clone(),
share_on: self.share_on.to_pb()?,
update_on: match &self.update_on {
Expand Down
7 changes: 3 additions & 4 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,7 +15,6 @@
//! 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 @@ -213,7 +212,7 @@ impl FromToProto for mt::TableMeta {
.map(mt::TableStatistics::from_pb)
.transpose()?
.unwrap_or_default(),
shared_by: BTreeSet::from_iter(p.shared_by.into_iter()),
shared_by: BTreeSet::from_iter(p.shared_by),
column_mask_policy: if p.column_mask_policy.is_empty() {
None
} else {
Expand Down Expand Up @@ -257,8 +256,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().into_iter()),
column_mask_policy: self.column_mask_policy.clone().unwrap_or(BTreeMap::new()),
shared_by: Vec::from_iter(self.shared_by.clone()),
column_mask_policy: self.column_mask_policy.clone().unwrap_or_default(),
owner: match self.owner.as_ref() {
Some(o) => Some(o.to_pb()?),
None => None,
Expand Down
Loading