Skip to content

Commit 3acb8aa

Browse files
authored
chore: bump rust toolchain to nightly-2024-01-23 (databendlabs#14434)
bump rust toolchain
1 parent 5dcd1d0 commit 3acb8aa

File tree

108 files changed

+311
-288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+311
-288
lines changed

.github/actions/build_linux/action.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ runs:
7070
artifacts="meta,metactl,query,sqllogictests"
7171
for artifact in ${artifacts//,/ }; do
7272
echo "==> building databend-$artifact ..."
73-
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --bin databend-$artifact
73+
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --bin databend-$artifact
7474
done
75-
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --bin open-sharing
75+
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --bin open-sharing
7676
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-*
7777
7878
- name: Build Debug for specific artifacts
@@ -82,7 +82,7 @@ runs:
8282
artifacts="${{ inputs.artifacts }}"
8383
for artifact in ${artifacts//,/ }; do
8484
echo "==> building databend-$artifact ..."
85-
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --bin databend-$artifact
85+
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --bin databend-$artifact
8686
done
8787
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-$artifact
8888
@@ -93,7 +93,7 @@ runs:
9393
artifacts="meta,metactl,query,sqllogictests"
9494
for artifact in ${artifacts//,/ }; do
9595
echo "==> building databend-$artifact ..."
96-
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --release --bin databend-$artifact
96+
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --release --bin databend-$artifact
9797
done
9898
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-$artifact
9999
@@ -104,7 +104,7 @@ runs:
104104
artifacts="${{ inputs.artifacts }}"
105105
for artifact in ${artifacts//,/ }; do
106106
echo "==> building databend-$artifact ..."
107-
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --release --bin databend-$artifact
107+
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --release --bin databend-$artifact
108108
done
109109
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-$artifact
110110

.github/actions/build_linux_sanitizer/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ runs:
5353
artifacts="meta,metactl,query"
5454
for artifact in ${artifacts//,/ }; do
5555
echo "==> building databend-$artifact with sanitizer ..."
56-
cargo -Zbuild-std -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --manifest-path src/binaries/Cargo.toml --bin databend-$artifact
56+
cargo -Zbuild-std -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --features ${{ inputs.features }} --manifest-path src/binaries/Cargo.toml --bin databend-$artifact
5757
done
5858
ls -lh ./target/${{ inputs.target }}/${{ env.BUILD_PROFILE }}/databend-*
5959

.github/actions/build_macos/action.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ runs:
4444
- name: Build Debug for all artifacts
4545
if: env.BUILD_PROFILE == 'debug' && inputs.artifacts == 'all'
4646
shell: bash
47-
run: cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }}
47+
run: cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }}
4848

4949
- name: Build Debug for specific artifacts
5050
if: env.BUILD_PROFILE == 'debug' && inputs.artifacts != 'all'
5151
shell: bash
5252
run: |
5353
artifacts="${{ inputs.artifacts }}"
5454
echo "==> building libs ..."
55-
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --lib
55+
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --lib
5656
for artifact in ${artifacts//,/ }; do
5757
echo "==> building databend-$artifact ..."
58-
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --bin databend-$artifact
58+
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --bin databend-$artifact
5959
done
6060
6161
- name: Build Release
@@ -64,10 +64,10 @@ runs:
6464
run: |
6565
artifacts="${{ inputs.artifacts }}"
6666
echo "==> building libs ..."
67-
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --release --lib
67+
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --release --lib
6868
for artifact in ${artifacts//,/ }; do
6969
echo "==> building databend-$artifact ..."
70-
cargo -Zgitoxide=fetch,shallow-index,shallow-deps build --target ${{ inputs.target }} --release --bin databend-$artifact
70+
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps build --target ${{ inputs.target }} --release --bin databend-$artifact
7171
done
7272
7373
- name: Upload artifact

.github/actions/check/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ runs:
4747

4848
- name: Clippy
4949
shell: bash
50-
run: cargo -Zgitoxide=fetch,shallow-index,shallow-deps clippy --workspace --all-targets --all-features -- -D warnings
50+
run: cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps clippy --workspace --all-targets --all-features -- -D warnings

.github/actions/test_unit/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ runs:
1111

1212
- shell: bash
1313
run: |
14-
cargo -Zgitoxide=fetch,shallow-index,shallow-deps nextest run --no-fail-fast --hide-progress-bar
14+
cargo -Zgitoxide=fetch -Zgit=shallow-index,shallow-deps nextest run --no-fail-fast --hide-progress-bar
1515
env:
1616
RUST_TEST_THREADS: "8"
1717
RUST_LOG: ERROR

rust-toolchain.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2023-10-23"
2+
channel = "nightly-2024-01-23"
33
components = ["rustfmt", "clippy", "rust-src", "miri", "rust-analyzer"]

src/common/arrow/src/arrow/array/boolean/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ mod from;
3333
mod iterator;
3434
mod mutable;
3535

36-
pub use iterator::*;
3736
pub use mutable::*;
3837

3938
/// A [`BooleanArray`] is Arrow's semantically equivalent of an immutable `Vec<Option<bool>>`.

src/common/arrow/src/arrow/array/dictionary/value_map.rs

+22-21
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,12 @@ impl<K: DictionaryKey, M: MutableArray> ValueMap<K, M> {
108108
// safety: we only iterate within bounds
109109
let value = unsafe { values.value_unchecked_at(index) };
110110
let hash = ahash_hash(value.borrow());
111-
match map.raw_entry_mut().from_hash(hash, |item| {
111+
let entry = map.raw_entry_mut().from_hash(hash, |item| {
112112
// safety: invariant of the struct, it's always in bounds since we maintain it
113113
let stored_value = unsafe { values.value_unchecked_at(item.key.as_usize()) };
114114
stored_value.borrow() == value.borrow()
115-
}) {
115+
});
116+
match entry {
116117
RawEntryMut::Occupied(_) => {
117118
return Err(Error::InvalidArgumentError(
118119
"duplicate value in dictionary values array".into(),
@@ -158,25 +159,25 @@ impl<K: DictionaryKey, M: MutableArray> ValueMap<K, M> {
158159
M::Type: Eq + Hash,
159160
{
160161
let hash = ahash_hash(value.as_indexed());
161-
Ok(
162-
match self.map.raw_entry_mut().from_hash(hash, |item| {
163-
// safety: we've already checked (the inverse) when we pushed it, so it should be ok?
164-
let index = unsafe { item.key.as_usize() };
165-
// safety: invariant of the struct, it's always in bounds since we maintain it
166-
let stored_value = unsafe { self.values.value_unchecked_at(index) };
167-
stored_value.borrow() == value.as_indexed()
168-
}) {
169-
RawEntryMut::Occupied(entry) => entry.key().key,
170-
RawEntryMut::Vacant(entry) => {
171-
let index = self.values.len();
172-
let key = K::try_from(index).map_err(|_| Error::Overflow)?;
173-
entry.insert_hashed_nocheck(hash, Hashed { hash, key }, ()); // NB: don't use .insert() here!
174-
push(&mut self.values, value)?;
175-
debug_assert_eq!(self.values.len(), index + 1);
176-
key
177-
}
178-
},
179-
)
162+
let entry = self.map.raw_entry_mut().from_hash(hash, |item| {
163+
// safety: we've already checked (the inverse) when we pushed it, so it should be ok?
164+
let index = unsafe { item.key.as_usize() };
165+
// safety: invariant of the struct, it's always in bounds since we maintain it
166+
let stored_value = unsafe { self.values.value_unchecked_at(index) };
167+
stored_value.borrow() == value.as_indexed()
168+
});
169+
let result = match entry {
170+
RawEntryMut::Occupied(entry) => entry.key().key,
171+
RawEntryMut::Vacant(entry) => {
172+
let index = self.values.len();
173+
let key = K::try_from(index).map_err(|_| Error::Overflow)?;
174+
entry.insert_hashed_nocheck(hash, Hashed { hash, key }, ()); // NB: don't use .insert() here!
175+
push(&mut self.values, value)?;
176+
debug_assert_eq!(self.values.len(), index + 1);
177+
key
178+
}
179+
};
180+
Ok(result)
180181
}
181182

182183
pub fn shrink_to_fit(&mut self) {

src/common/arrow/src/arrow/array/fixed_size_list/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ mod data;
2626
mod ffi;
2727
pub(super) mod fmt;
2828
mod iterator;
29-
pub use iterator::*;
3029
mod mutable;
3130
pub use mutable::*;
3231

src/common/arrow/src/arrow/array/map/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ mod data;
2727
mod ffi;
2828
pub(super) mod fmt;
2929
mod iterator;
30-
pub use iterator::*;
3130

3231
/// An array representing a (key, value), both of arbitrary logical types.
3332
#[derive(Clone)]

src/common/arrow/src/arrow/array/primitive/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ mod ffi;
3535
pub(super) mod fmt;
3636
mod from_natural;
3737
mod iterator;
38-
pub use iterator::*;
3938
mod mutable;
4039
pub use mutable::*;
4140

src/common/arrow/src/arrow/buffer/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use std::ops::Deref;
2222

2323
use crate::arrow::ffi::InternalArrowArray;
2424

25+
#[allow(dead_code)]
2526
pub(crate) enum BytesAllocator {
2627
InternalArrowArray(InternalArrowArray),
2728

src/common/arrow/src/arrow/compute/sort/row/variable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub fn encoded_len(a: Option<&[u8]>) -> usize {
5959
pub fn encode<'a, I: Iterator<Item = Option<&'a [u8]>>>(out: &mut Rows, i: I, opts: SortOptions) {
6060
for (offset, maybe_val) in out.offsets.iter_mut().skip(1).zip(i) {
6161
match maybe_val {
62-
Some(val) if val.is_empty() => {
62+
Some([]) => {
6363
out.buffer[*offset] = match opts.descending {
6464
true => !EMPTY_SENTINEL,
6565
false => EMPTY_SENTINEL,

src/common/arrow/src/arrow/io/parquet/read/deserialize/nested_utils.rs

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use super::super::Pages;
2626
use super::utils::DecodedState;
2727
use super::utils::MaybeNext;
2828
use super::utils::PageState;
29-
pub use super::utils::Zip;
3029
use crate::arrow::array::Array;
3130
use crate::arrow::bitmap::MutableBitmap;
3231
use crate::arrow::error::Result;

src/common/arrow/src/arrow/io/parquet/read/deserialize/primitive/basic.rs

-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ impl<T, I, P, F> Iter<T, I, P, F>
321321
where
322322
I: Pages,
323323
T: NativeType,
324-
325324
P: ParquetNativeType,
326325
F: Copy + Fn(P) -> T,
327326
{

src/common/arrow/src/arrow/io/parquet/read/deserialize/primitive/dictionary.rs

-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ where
7474
K: DictionaryKey,
7575
I: Pages,
7676
T: NativeType,
77-
7877
P: ParquetNativeType,
7978
F: Copy + Fn(P) -> T,
8079
{
@@ -153,7 +152,6 @@ where
153152
K: DictionaryKey,
154153
I: Pages,
155154
T: NativeType,
156-
157155
P: ParquetNativeType,
158156
F: Copy + Fn(P) -> T,
159157
{

src/common/arrow/src/arrow/io/parquet/read/deserialize/primitive/integer.rs

-1
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ impl<T, I, P, F> IntegerIter<T, I, P, F>
226226
where
227227
I: Pages,
228228
T: NativeType,
229-
230229
P: ParquetNativeType,
231230
F: Copy + Fn(P) -> T,
232231
{

src/common/arrow/src/arrow/io/parquet/read/deserialize/primitive/nested.rs

-3
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ pub struct NestedIter<T, I, P, F>
187187
where
188188
I: Pages,
189189
T: NativeType,
190-
191190
P: ParquetNativeType,
192191
F: Copy + Fn(P) -> T,
193192
{
@@ -205,7 +204,6 @@ impl<T, I, P, F> NestedIter<T, I, P, F>
205204
where
206205
I: Pages,
207206
T: NativeType,
208-
209207
P: ParquetNativeType,
210208
F: Copy + Fn(P) -> T,
211209
{
@@ -234,7 +232,6 @@ impl<T, I, P, F> Iterator for NestedIter<T, I, P, F>
234232
where
235233
I: Pages,
236234
T: NativeType,
237-
238235
P: ParquetNativeType,
239236
F: Copy + Fn(P) -> T,
240237
{

src/common/arrow/src/arrow/types/simd/packed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ pub use std::simd::i8x8;
2626
pub use std::simd::mask32x16 as m32x16;
2727
pub use std::simd::mask64x8 as m64x8;
2828
pub use std::simd::mask8x64 as m8x64;
29+
pub use std::simd::prelude::SimdPartialEq;
2930
pub use std::simd::u16x32;
3031
pub use std::simd::u16x8;
3132
pub use std::simd::u32x16;
3233
pub use std::simd::u32x8;
3334
pub use std::simd::u64x8;
3435
pub use std::simd::u8x64;
3536
pub use std::simd::u8x8;
36-
pub use std::simd::SimdPartialEq;
3737

3838
/// Vector of 32 16-bit masks
3939
#[allow(non_camel_case_types)]

src/common/arrow/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
#![feature(iter_advance_by)]
16+
#![allow(clippy::unconditional_recursion)]
1617
#![cfg_attr(feature = "simd", feature(portable_simd))]
1718
#![allow(clippy::redundant_closure_call)]
1819
#![allow(clippy::non_canonical_partial_ord_impl)]

src/common/arrow/tests/it/arrow/array/binary/mutable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn from_iter() {
5353

5454
#[test]
5555
fn from_trusted_len_iter() {
56-
let data = vec![vec![0; 0], vec![1; 1], vec![2; 2]];
56+
let data = [vec![0; 0], vec![1; 1], vec![2; 2]];
5757
let a: MutableBinaryArray<i32> = data.iter().cloned().map(Some).collect();
5858
assert_eq!(a.values().deref(), &[1u8, 2, 2]);
5959
assert_eq!(a.offsets().as_slice(), &[0, 0, 1, 3]);

src/common/base/src/runtime/runtime_tracker.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ use std::fmt::Formatter;
4949
use std::future::Future;
5050
use std::mem::take;
5151
use std::pin::Pin;
52+
use std::ptr::addr_of_mut;
5253
use std::sync::atomic::AtomicI64;
5354
use std::sync::atomic::Ordering;
5455
use std::sync::Arc;
@@ -67,7 +68,7 @@ pub static GLOBAL_MEM_STAT: MemStat = MemStat::global();
6768
// For implemented and needs to call drop, we cannot use the attribute tag thread local.
6869
// https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=ea33533387d401e86423df1a764b5609
6970
thread_local! {
70-
static TRACKER: RefCell<ThreadTracker> = RefCell::new(ThreadTracker::empty());
71+
static TRACKER: RefCell<ThreadTracker> = const { RefCell::new(ThreadTracker::empty()) };
7172
}
7273

7374
#[thread_local]
@@ -231,7 +232,7 @@ impl ThreadTracker {
231232
/// `size` is the positive number of allocated bytes.
232233
#[inline]
233234
pub fn alloc(size: i64) -> Result<(), AllocError> {
234-
let state_buffer = unsafe { &mut STAT_BUFFER };
235+
let state_buffer = unsafe { &mut *addr_of_mut!(STAT_BUFFER) };
235236

236237
// Rust will alloc or dealloc memory after the thread local is destroyed when we using thread_local macro.
237238
// This is the boundary of thread exit. It may be dangerous to throw mistakes here.
@@ -265,7 +266,7 @@ impl ThreadTracker {
265266
/// `size` is positive number of bytes of the memory to deallocate.
266267
#[inline]
267268
pub fn dealloc(size: i64) {
268-
let state_buffer = unsafe { &mut STAT_BUFFER };
269+
let state_buffer = unsafe { &mut *addr_of_mut!(STAT_BUFFER) };
269270

270271
// Rust will alloc or dealloc memory after the thread local is destroyed when we using thread_local macro.
271272
if state_buffer.destroyed_thread_local_macro {

src/common/hashtable/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#![allow(internal_features)]
16+
#![allow(clippy::ptr_arg)]
1517
#![feature(core_intrinsics)]
1618
#![feature(allocator_api)]
1719
#![feature(arbitrary_self_types)]

src/common/io/src/bitmap.rs

+14-11
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use databend_common_exception::Result;
1717
use roaring::RoaringTreemap;
1818

1919
pub fn parse_bitmap(buf: &[u8]) -> Result<RoaringTreemap> {
20-
match std::str::from_utf8(buf)
20+
std::str::from_utf8(buf)
2121
.map_err(|e| e.to_string())
2222
.and_then(|s| {
2323
let s: String = s.chars().filter(|c| !c.is_whitespace()).collect();
@@ -26,14 +26,17 @@ pub fn parse_bitmap(buf: &[u8]) -> Result<RoaringTreemap> {
2626
.map(|v| v.parse::<u64>().map_err(|e| e.to_string()))
2727
.collect();
2828
result
29-
}) {
30-
Ok(v) => {
31-
let rb = RoaringTreemap::from_iter(v.iter());
32-
Ok(rb)
33-
}
34-
Err(_) => Err(ErrorCode::BadBytes(format!(
35-
"Invalid Bitmap value: {:?}",
36-
String::from_utf8_lossy(buf)
37-
))),
38-
}
29+
})
30+
.map_or_else(
31+
|_| {
32+
Err(ErrorCode::BadBytes(format!(
33+
"Invalid Bitmap value: {:?}",
34+
String::from_utf8_lossy(buf)
35+
)))
36+
},
37+
|v| {
38+
let rb = RoaringTreemap::from_iter(v.iter());
39+
Ok(rb)
40+
},
41+
)
3942
}

0 commit comments

Comments
 (0)