Skip to content

Commit

Permalink
build: bump toolchain to 2024-06-12 (#17179)
Browse files Browse the repository at this point in the history
Signed-off-by: xxchan <[email protected]>
  • Loading branch information
xxchan authored Aug 4, 2024
1 parent c09d264 commit 3c745df
Show file tree
Hide file tree
Showing 59 changed files with 344 additions and 293 deletions.
24 changes: 16 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,16 @@ rw_iter_util = { path = "src/utils/iter_util" }
[workspace.lints.rust]
# `forbid` will also prevent the misuse of `#[allow(unused)]`
unused_must_use = "forbid"
future_incompatible = "warn"
nonstandard_style = "warn"
rust_2018_idioms = "warn"
future_incompatible = { level = "warn", priority = -1 }
nonstandard_style = { level = "warn", priority = -1 }
rust_2018_idioms = { level = "warn", priority = -1 }
# Backward compatibility is not important for an application.
async_fn_in_trait = "allow"
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(madsim)',
'cfg(coverage)',
'cfg(dashboard_built)',
] }

[workspace.lints.clippy]
uninlined_format_args = "allow"
Expand Down
2 changes: 1 addition & 1 deletion ci/build-ci-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cat ../rust-toolchain
# shellcheck disable=SC2155

# REMEMBER TO ALSO UPDATE ci/docker-compose.yml
export BUILD_ENV_VERSION=v20240729
export BUILD_ENV_VERSION=v20240731

export BUILD_TAG="public.ecr.aws/w1p7b4n3/rw-build-env:${BUILD_ENV_VERSION}"

Expand Down
10 changes: 5 additions & 5 deletions ci/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ services:
retries: 5

source-test-env:
image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240729
image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240731
depends_on:
- mysql
- db
Expand All @@ -84,7 +84,7 @@ services:
- ..:/risingwave

sink-test-env:
image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240729
image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240731
depends_on:
- mysql
- db
Expand All @@ -107,12 +107,12 @@ services:


rw-build-env:
image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240729
image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240731
volumes:
- ..:/risingwave

ci-flamegraph-env:
image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240729
image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240731
# NOTE(kwannoel): This is used in order to permit
# syscalls for `nperf` (perf_event_open),
# so it can do CPU profiling.
Expand All @@ -123,7 +123,7 @@ services:
- ..:/risingwave

regress-test-env:
image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240729
image: public.ecr.aws/w1p7b4n3/rw-build-env:v20240731
depends_on:
db:
condition: service_healthy
Expand Down
2 changes: 1 addition & 1 deletion ci/rust-toolchain
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# 3. (optional) **follow the instructions in lints/README.md** to update the toolchain and dependencies for lints

[toolchain]
channel = "nightly-2024-03-12"
channel = "nightly-2024-06-06"
2 changes: 1 addition & 1 deletion ci/scripts/build-other.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ set -euo pipefail

source ci/scripts/common.sh


echo "--- Build Rust UDF"
cd e2e_test/udf/wasm
rustup target add wasm32-wasi
cargo build --release
cd ../../..

Expand Down
3 changes: 3 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ doc-valid-idents = [
avoid-breaking-exported-api = false
upper-case-acronyms-aggressive = true
too-many-arguments-threshold = 10
ignore-interior-mutability = [
"risingwave_frontend::expr::ExprImpl" # XXX: Where does ExprImpl have interior mutability?
]
4 changes: 2 additions & 2 deletions e2e_test/source_inline/pubsub/prepare-data.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env -S cargo -Zscript
```cargo
---cargo
[dependencies]
anyhow = "1"
google-cloud-googleapis = { version = "0.13", features = ["pubsub"] }
Expand All @@ -13,7 +13,7 @@ tokio = { version = "0.2", package = "madsim-tokio", features = [
"signal",
"fs",
] }
```
---

use google_cloud_googleapis::pubsub::v1::PubsubMessage;
use google_cloud_pubsub::client::{Client, ClientConfig};
Expand Down
6 changes: 2 additions & 4 deletions lints/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 lints/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ path = "ui/format_error.rs"
# See `README.md` before bumping the version.
# Remember to update the version in `ci/Dockerfile` as well.
[dependencies]
clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "fca4e16ffb8c07186ee23becd44cd5c9fb51896c" }
clippy_utils = { git = "https://github.com/risingwavelabs/clippy", rev = "5e2a7c6adebdb0478ee6d5b67ab4ee94153b2997" }
dylint_linting = "3.1.0"
itertools = "0.12"

Expand Down
9 changes: 7 additions & 2 deletions lints/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ Duplicate `.vscode/settings.json.example` to `.vscode/settings.json` to enable r

## Bump toolchain

The version of the toolchain is specified in `rust-toolchain` file under current directory.
It does not have to be exactly the same as the one used to build RisingWave, but it should be close enough to avoid compile errors.
The version of the toolchain is specified in `rust-toolchain` file under current directory. It will be used to build the lints, and also be used by `dylint` to compile RisingWave, instead of the root-level `rust-toolchain`.

So the chosen toolchain needs to
1. be close enough to the root-level `rust-toolchain` to make RisingWave compile. It does not have to be exactly the same version though.
2. be close enough to the dependency `clippy_utils`'s corresponding `rust-toolchain` in the Clippy's repo.

(Note: `clippy_utils` depends on rustc's internal unstable API. When rustc has breaking changes, the `rust` repo's Clippy will be updated. And then it's [synced back to the Clippy repo bi-weekly](https://doc.rust-lang.org/clippy/development/infrastructure/sync.html#syncing-changes-between-clippy-and-rust-langrust). So ideally we can use `clippy_utils` in the rust repo corresponding to our root-level nightly version, but that repo is too large. Perhaps we can also consider copy the code out to workaround this problem.)

The information below can be helpful in finding the appropriate version to bump to.

Expand Down
2 changes: 1 addition & 1 deletion lints/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# See `README.md` before bumping the version.

[toolchain]
channel = "nightly-2024-04-18"
channel = "nightly-2024-06-06"
components = ["llvm-tools-preview", "rustc-dev"]
14 changes: 11 additions & 3 deletions lints/src/format_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use clippy_utils::diagnostics::span_lint_and_help;
use clippy_utils::macros::{
find_format_arg_expr, find_format_args, is_format_macro, macro_backtrace,
find_format_arg_expr, is_format_macro, macro_backtrace, FormatArgsStorage,
};
use clippy_utils::ty::{implements_trait, match_type};
use clippy_utils::{
Expand Down Expand Up @@ -56,7 +56,15 @@ declare_tool_lint! {
}

#[derive(Default)]
pub struct FormatError;
pub struct FormatError {
format_args: FormatArgsStorage,
}

impl FormatError {
pub fn new(format_args: FormatArgsStorage) -> Self {
Self { format_args }
}
}

impl_lint_pass!(FormatError => [FORMAT_ERROR]);

Expand Down Expand Up @@ -90,7 +98,7 @@ impl<'tcx> LateLintPass<'tcx> for FormatError {

for macro_call in macro_backtrace(expr.span) {
if is_format_macro(cx, macro_call.def_id)
&& let Some(format_args) = find_format_args(cx, expr, macro_call.expn)
&& let Some(format_args) = self.format_args.get(cx, expr, macro_call.expn)
{
for piece in &format_args.template {
if let FormatArgsPiece::Placeholder(placeholder) = piece
Expand Down
13 changes: 9 additions & 4 deletions lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#![feature(rustc_private)]
#![feature(let_chains)]
#![feature(lazy_cell)]
#![warn(unused_extern_crates)]

extern crate rustc_ast;
Expand All @@ -36,13 +35,19 @@ pub fn register_lints(_sess: &rustc_session::Session, lint_store: &mut rustc_lin
// -- Begin lint registration --

// Preparation steps.
lint_store.register_early_pass(|| {
Box::<utils::format_args_collector::FormatArgsCollector>::default()
let format_args_storage = clippy_utils::macros::FormatArgsStorage::default();
let format_args = format_args_storage.clone();
lint_store.register_early_pass(move || {
Box::new(utils::format_args_collector::FormatArgsCollector::new(
format_args.clone(),
))
});

// Actual lints.
lint_store.register_lints(&[format_error::FORMAT_ERROR]);
lint_store.register_late_pass(|_| Box::<format_error::FormatError>::default());
let format_args = format_args_storage.clone();
lint_store
.register_late_pass(move |_| Box::new(format_error::FormatError::new(format_args.clone())));

// -- End lint registration --

Expand Down
30 changes: 16 additions & 14 deletions lints/src/utils/format_args_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//! Copied from `https://github.com/rust-lang/rust-clippy/blob/8b0bf6423dfaf5545014db85fcba7bc745beed4c/clippy_lints/src/utils/format_args_collector.rs`
//!
//! Init `AST_FORMAT_ARGS` before running the late pass, so that we can call `find_format_args`.
//! Copied from `https://github.com/rust-lang/rust-clippy/blob/993d8ae2a7b26ac779fde923b2ce9ce35d7143a8/clippy_lints/src/utils/format_args_collector.rs`
use std::iter::once;
use std::mem;
use std::rc::Rc;

use clippy_utils::macros::AST_FORMAT_ARGS;
use clippy_utils::macros::FormatArgsStorage;
use clippy_utils::source::snippet_opt;
use itertools::Itertools;
use rustc_ast::{Crate, Expr, ExprKind, FormatArgs};
Expand All @@ -30,11 +27,19 @@ use rustc_lint::{EarlyContext, EarlyLintPass};
use rustc_session::impl_lint_pass;
use rustc_span::{hygiene, Span};

/// Collects [`rustc_ast::FormatArgs`] so that future late passes can call
/// [`clippy_utils::macros::find_format_args`]
#[derive(Default)]
/// Populates [`FormatArgsStorage`] with AST [`FormatArgs`] nodes
pub struct FormatArgsCollector {
format_args: FxHashMap<Span, Rc<FormatArgs>>,
format_args: FxHashMap<Span, FormatArgs>,
storage: FormatArgsStorage,
}

impl FormatArgsCollector {
pub fn new(storage: FormatArgsStorage) -> Self {
Self {
format_args: FxHashMap::default(),
storage,
}
}
}

impl_lint_pass!(FormatArgsCollector => []);
Expand All @@ -47,15 +52,12 @@ impl EarlyLintPass for FormatArgsCollector {
}

self.format_args
.insert(expr.span.with_parent(None), Rc::new((**args).clone()));
.insert(expr.span.with_parent(None), (**args).clone());
}
}

fn check_crate_post(&mut self, _: &EarlyContext<'_>, _: &Crate) {
AST_FORMAT_ARGS.with(|ast_format_args| {
let result = ast_format_args.set(mem::take(&mut self.format_args));
debug_assert!(result.is_ok());
});
self.storage.set(mem::take(&mut self.format_args));
}
}

Expand Down
29 changes: 16 additions & 13 deletions src/batch/src/executor/log_row_seq_scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,21 +206,24 @@ impl<S: StateStore> LogRowSeqScanExecutor<S> {
.batch_iter_log_with_pk_bounds(old_epoch, new_epoch)
.await?
.flat_map(|r| {
futures::stream::iter(std::iter::from_coroutine(move || {
match r {
Ok(change_log_row) => {
fn with_op(op: Op, row: impl Row) -> impl Row {
row.chain([Some(ScalarImpl::Int16(op.to_i16()))])
futures::stream::iter(std::iter::from_coroutine(
#[coroutine]
move || {
match r {
Ok(change_log_row) => {
fn with_op(op: Op, row: impl Row) -> impl Row {
row.chain([Some(ScalarImpl::Int16(op.to_i16()))])
}
for (op, row) in change_log_row.into_op_value_iter() {
yield Ok(with_op(op, row));
}
}
for (op, row) in change_log_row.into_op_value_iter() {
yield Ok(with_op(op, row));
Err(e) => {
yield Err(e);
}
}
Err(e) => {
yield Err(e);
}
};
}))
};
},
))
});

pin_mut!(iter);
Expand Down
Loading

0 comments on commit 3c745df

Please sign in to comment.