Skip to content

Commit

Permalink
chore(lints): bump toolchain to make it work again (#14680)
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao authored and Little-Wallace committed Jan 20, 2024
1 parent 5484a23 commit 5c25ba7
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 46 deletions.
4 changes: 2 additions & 2 deletions ci/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# To update toolchain, do the following:
# 1. update this file
# 2. update lints/rust-toolchain, lints/Cargo.toml
# 3. update ci/build-ci-image.sh and ci/docker-compose.yml to build a new CI image
# 2. update ci/build-ci-image.sh and ci/docker-compose.yml to build a new CI image
# 3. (optional) **follow the instructions in lints/README.md** to update the toolchain and dependencies for lints

[toolchain]
channel = "nightly-2023-12-26"
115 changes: 75 additions & 40 deletions lints/Cargo.lock

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

7 changes: 4 additions & 3 deletions lints/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ crate-type = ["cdylib"]
name = "format_error"
path = "ui/format_error.rs"

# See `README.md` before bumping the version.
[dependencies]
clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "e4c626dd9a17a23270bf8e7158e59cf2b9c04840" } # should match the toolchain version (rustc -vV)
dylint_linting = "2.5.0"
clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "6fd0258e45105161b7e759a22e7350958e5cb0b1" }
dylint_linting = "2.6.0"
itertools = "0.12"

[dev-dependencies]
dylint_testing = "2.5.0"
dylint_testing = "2.6.0"

# UI test dependencies
tracing = "0.1"
Expand Down
21 changes: 21 additions & 0 deletions lints/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ Custom lints for RisingWave to enforce code style and best practices, empowered

See [cargo dylint](https://github.com/trailofbits/dylint) for more information.

## Install `cargo-dylint`

```bash
cargo install dylint
```

## Run lints

To run all lints, run `cargo dylint --all` in the root of the repository.

If you find there are some compile errors, try updating the `cargo-dylint` binary by installing it again.

## Add new lints

To add a new lint, add a new file in the `src` directory to declare the lint, then register it in `fn register_lints(..)` in `lib.rs`.
Expand All @@ -19,3 +27,16 @@ To test a lint, create a new file in the `ui` directory and add it as an `exampl
## VS Code integration

Duplicate `.vscode/settings.json.example` to `.vscode/settings.json` to enable rust-analyzer integration for developing lints.

## 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 information below can be helpful in finding the appropriate version to bump to.

- The toolchain used by the latest version of `cargo-dylint`: https://github.com/trailofbits/dylint/blob/master/internal/template/rust-toolchain
- The toolchain used by the latest version of `clippy`: https://github.com/rust-lang/rust-clippy/blob/master/rust-toolchain
- The hash of the latest commit in `rust-lang/rust-clippy` repo for the dependency `clippy-utils`.

Run the lints after bumping the toolchain to verify it works.
4 changes: 3 additions & 1 deletion lints/rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# See `README.md` before bumping the version.

[toolchain]
channel = "nightly-2023-12-26" # should be identical to the root one
channel = "nightly-2024-01-11"
components = ["llvm-tools-preview", "rustc-dev"]

0 comments on commit 5c25ba7

Please sign in to comment.