Skip to content
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

build: bump toolchain to 2023-09-09 #11809

Merged
merged 33 commits into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
9d3e587
bump toolchain
TennyZhuang Jul 28, 2023
605bb56
Merge branch 'main' into tygg-bump-toolchain-20230728
xxchan Aug 20, 2023
ade0d7e
remove dup resolver = 2
xxchan Aug 20, 2023
5a7bcbb
bump to 08-21, fixing TAIT bug
xxchan Aug 21, 2023
1059d1e
rustfmt: fmt let-else, disable wrap_comments
xxchan Aug 21, 2023
09af429
Merge branch 'main' into tygg-bump-toolchain-20230728
xxchan Aug 21, 2023
bf19bda
revert changes about TAIT
xxchan Aug 21, 2023
cf32041
Merge branch 'main' into tygg-bump-toolchain-20230728
MrCroxx Aug 28, 2023
74331f2
fix some clippy reports
MrCroxx Aug 28, 2023
6f78e2a
fix some clippy report
MrCroxx Aug 28, 2023
4004aa0
fix all clippy reports
MrCroxx Aug 28, 2023
722f8f6
fix bugs
MrCroxx Aug 28, 2023
fd087d6
Merge branch 'main' into tygg-bump-toolchain-20230728
MrCroxx Aug 28, 2023
bf3bbe7
update docker version
MrCroxx Aug 29, 2023
5f2fcff
Merge branch 'main' into tygg-bump-toolchain-20230728
MrCroxx Aug 29, 2023
cc5d116
install sccache with binstall
MrCroxx Aug 29, 2023
7e6e7c3
update docker build
MrCroxx Aug 29, 2023
cc55bac
use expect insteal of allow
MrCroxx Aug 29, 2023
06c6a59
fix lifetime
MrCroxx Aug 29, 2023
ed3a75a
fix state store stream compile
wenym1 Aug 29, 2023
5ab88a8
Merge remote-tracking branch 'origin/main' into tygg-bump-toolchain-2…
xxchan Sep 9, 2023
ab8c61c
fix thiserror/anyhow, fmt, some clippy
xxchan Sep 9, 2023
3d3f863
fix clippy
xxchan Sep 9, 2023
ae36c29
prefer `error::request_ref`
xxchan Sep 9, 2023
6325dbd
fix sqlsmith clippy
xxchan Sep 9, 2023
3c399e9
bump to 2023-09-09, use [lints] table
xxchan Sep 9, 2023
7a21774
update ci image
xxchan Sep 9, 2023
1dc58b5
Fix "cargo-hakari"
xxchan Sep 9, 2023
ca8b696
use [lints]
xxchan Sep 9, 2023
620e5c4
fix
xxchan Sep 9, 2023
200c771
update gen-flamegraph.sh
xxchan Sep 9, 2023
26413b8
fix reschedule bug
xxchan Sep 9, 2023
69f2e71
Merge branch 'main' into tygg-bump-toolchain-20230728
xxchan Sep 9, 2023
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
41 changes: 16 additions & 25 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 ci/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "nightly-2023-05-31"
channel = "nightly-2023-08-21"
5 changes: 4 additions & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ group_imports = "StdExternalCrate"
reorder_impl_items = true
reorder_imports = true
tab_spaces = 4
wrap_comments = true
# TODO: Fix it later. It produces too many unwanted changes related with markdown lists now. e.g.,
# https://github.com/rust-lang/rustfmt/issues/5862
# https://github.com/rust-lang/rustfmt/issues/5836
# wrap_comments = true
23 changes: 11 additions & 12 deletions src/common/common_service/src/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,17 @@ where
let mut inner = std::mem::replace(&mut self.inner, clone);

async move {
let span = if let Some(tracing_context) =
TracingContext::from_http_headers(req.headers())
{
let span = tracing::info_span!(
"grpc_serve",
"otel.name" = req.uri().path(),
uri = %req.uri()
);
tracing_context.attach(span)
} else {
tracing::Span::none() // if there's no parent span, disable tracing for this request
};
let span =
if let Some(tracing_context) = TracingContext::from_http_headers(req.headers()) {
let span = tracing::info_span!(
"grpc_serve",
"otel.name" = req.uri().path(),
uri = %req.uri()
);
tracing_context.attach(span)
} else {
tracing::Span::none() // if there's no parent span, disable tracing for this request
};

inner.call(req).instrument(span).await
}
Expand Down
5 changes: 2 additions & 3 deletions src/common/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use std::backtrace::Backtrace;
use std::collections::HashSet;
use std::convert::Infallible;
use std::error::request_ref;
use std::fmt::{Debug, Display, Formatter};
use std::io::Error as IoError;
use std::time::{Duration, SystemTime};
Expand Down Expand Up @@ -234,9 +235,7 @@ impl Debug for RwError {
"{}\n{}",
self.inner,
// Use inner error's backtrace by default, otherwise use the generated one in `From`.
(&self.inner as &dyn std::error::Error)
.request_ref::<Backtrace>()
.unwrap_or(&*self.backtrace)
request_ref::<Backtrace>(&self.inner).unwrap_or(&*self.backtrace)
)
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

#![allow(rustdoc::private_intra_doc_links)]
#![feature(drain_filter)]
#![feature(extract_if)]
#![feature(trait_alias)]
#![feature(binary_heap_drain_sorted)]
#![feature(is_sorted)]
Expand All @@ -26,7 +26,6 @@
#![feature(map_try_insert)]
#![feature(lazy_cell)]
#![feature(error_generic_member_access)]
#![feature(provide_any)]
#![feature(let_chains)]
#![feature(return_position_impl_trait_in_trait)]
#![feature(portable_simd)]
Expand Down
8 changes: 6 additions & 2 deletions src/common/src/types/decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,9 @@ impl Decimal {
pub const MAX_PRECISION: u8 = 28;

pub fn scale(&self) -> Option<i32> {
let Decimal::Normalized(d) = self else { return None };
let Decimal::Normalized(d) = self else {
return None;
};
Some(d.scale() as _)
}

Expand All @@ -428,7 +430,9 @@ impl Decimal {
/// Round to the left of the decimal point, for example `31.5` -> `30`.
#[must_use]
pub fn round_left_ties_away(&self, left: u32) -> Option<Self> {
let Self::Normalized(mut d) = self else { return Some(*self) };
let Self::Normalized(mut d) = self else {
return Some(*self);
};

// First, move the decimal point to the left so that we can reuse `round`. This is more
// efficient than division.
Expand Down
2 changes: 1 addition & 1 deletion src/common/src/vnode_mapping/vnode_placement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub fn place_vnode(
// evenly among workers.
let mut selected_pu_ids = Vec::new();
while !new_pus.is_empty() {
new_pus.drain_filter(|ps| {
let _ = new_pus.extract_if(|ps| {
if let Some(p) = ps.next() {
selected_pu_ids.push(p.id);
false
Expand Down
2 changes: 1 addition & 1 deletion src/ctl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

#![feature(let_chains)]
#![feature(hash_drain_filter)]
#![feature(hash_extract_if)]

use anyhow::Result;
use clap::{Parser, Subcommand};
Expand Down
48 changes: 36 additions & 12 deletions src/expr/macro/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ impl Parse for UserFunctionAttr {

/// Check if the last argument is `&mut dyn Write`.
fn last_arg_is_write(sig: &syn::Signature) -> bool {
let Some(syn::FnArg::Typed(arg)) = sig.inputs.last() else { return false };
let Some(syn::FnArg::Typed(arg)) = sig.inputs.last() else {
return false;
};
let syn::Type::Reference(syn::TypeReference { elem, .. }) = arg.ty.as_ref() else {
return false;
};
Expand All @@ -128,8 +130,12 @@ fn last_arg_is_write(sig: &syn::Signature) -> bool {

/// Check if the last argument is `retract: bool`.
fn last_arg_is_retract(sig: &syn::Signature) -> bool {
let Some(syn::FnArg::Typed(arg)) = sig.inputs.last() else { return false };
let syn::Pat::Ident(pat) = &*arg.pat else { return false };
let Some(syn::FnArg::Typed(arg)) = sig.inputs.last() else {
return false;
};
let syn::Pat::Ident(pat) = &*arg.pat else {
return false;
};
pat.ident.to_string().contains("retract")
}

Expand All @@ -139,9 +145,15 @@ fn args_contain_option(sig: &syn::Signature) -> bool {
return false;
}
for arg in &sig.inputs {
let syn::FnArg::Typed(arg) = arg else { return false };
let syn::Type::Path(path) = arg.ty.as_ref() else { return false };
let Some(seg) = path.path.segments.last() else { return false };
let syn::FnArg::Typed(arg) = arg else {
return false;
};
let syn::Type::Path(path) = arg.ty.as_ref() else {
return false;
};
let Some(seg) = path.path.segments.last() else {
return false;
};
if seg.ident == "Option" {
return true;
}
Expand All @@ -168,20 +180,32 @@ fn check_type(ty: &syn::Type) -> (ReturnType, &syn::Type) {

/// Check if the type is `type_<T>` and return `T`.
fn strip_outer_type<'a>(ty: &'a syn::Type, type_: &str) -> Option<&'a syn::Type> {
let syn::Type::Path(path) = ty else { return None };
let Some(seg) = path.path.segments.last() else { return None };
let syn::Type::Path(path) = ty else {
return None;
};
let Some(seg) = path.path.segments.last() else {
return None;
};
if seg.ident != type_ {
return None;
}
let syn::PathArguments::AngleBracketed(args) = &seg.arguments else { return None };
let Some(syn::GenericArgument::Type(ty)) = args.args.first() else { return None };
let syn::PathArguments::AngleBracketed(args) = &seg.arguments else {
return None;
};
let Some(syn::GenericArgument::Type(ty)) = args.args.first() else {
return None;
};
Some(ty)
}

/// Check if the type is `impl Iterator<Item = T>` and return `T`.
fn strip_iterator(ty: &syn::Type) -> Option<&syn::Type> {
let syn::Type::ImplTrait(impl_trait) = ty else { return None; };
let syn::TypeParamBound::Trait(trait_bound) = impl_trait.bounds.first()? else { return None; };
let syn::Type::ImplTrait(impl_trait) = ty else {
return None;
};
let syn::TypeParamBound::Trait(trait_bound) = impl_trait.bounds.first()? else {
return None;
};
let segment = trait_bound.path.segments.last().unwrap();
if segment.ident != "Iterator" {
return None;
Expand Down
4 changes: 3 additions & 1 deletion src/expr/src/agg/string_agg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ fn string_agg(
delimiter: Option<&str>,
) -> Option<String> {
let Some(value) = value else { return state };
let Some(mut state) = state else { return Some(value.into()) };
let Some(mut state) = state else {
return Some(value.into());
};
state += delimiter.unwrap_or("");
state += value;
Some(state)
Expand Down
4 changes: 3 additions & 1 deletion src/expr/src/expr/expr_some_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ impl Expression for SomeAllExpression {
let mut num_array = Vec::with_capacity(data_chunk.capacity());

let arr_right_inner = arr_right.as_list();
let DataType::List(datatype) = arr_right_inner.data_type() else { unreachable!() };
let DataType::List(datatype) = arr_right_inner.data_type() else {
unreachable!()
};
let capacity = arr_right_inner
.iter()
.flatten()
Expand Down
21 changes: 12 additions & 9 deletions src/frontend/src/binder/expr/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1111,19 +1111,22 @@ impl Binder {

fn rewrite_format_to_concat_ws(inputs: Vec<ExprImpl>) -> Result<Vec<ExprImpl>> {
let Some((format_expr, args)) = inputs.split_first() else {
return Err(
ErrorCode::BindError("Function `format` takes at least 1 arguments (0 given)".to_string()).into(),
);
return Err(ErrorCode::BindError(
"Function `format` takes at least 1 arguments (0 given)".to_string(),
)
.into());
};
let ExprImpl::Literal(expr_literal) = format_expr else {
return Err(
ErrorCode::BindError("Function `format` takes a literal string as the first argument".to_string()).into(),
);
return Err(ErrorCode::BindError(
"Function `format` takes a literal string as the first argument".to_string(),
)
.into());
};
let Some(ScalarImpl::Utf8(format_str)) = expr_literal.get_data() else {
return Err(
ErrorCode::BindError("Function `format` takes a literal string as the first argument".to_string()).into(),
);
return Err(ErrorCode::BindError(
"Function `format` takes a literal string as the first argument".to_string(),
)
.into());
};
let formatter = Formatter::parse(format_str)
.map_err(|err| -> RwError { ErrorCode::BindError(err.to_string()).into() })?;
Expand Down
4 changes: 3 additions & 1 deletion src/frontend/src/expr/type_inference/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,9 @@ fn narrow_category<'a>(
.all(|(formal, category)| {
// category.is_none() means the actual argument is non-null and skipped category
// selection.
let Some(selected) = category else { return true };
let Some(selected) = category else {
return true;
};
*formal == *selected
|| !is_preferred(*selected) && implicit_ok(*formal, *selected, false)
})
Expand Down
Loading