Skip to content

Commit 7e7b596

Browse files
andyscottcodex
andcommitted
Add Bazel-native Dylint support
Introduce explicit Dylint rules, nightly rustc-dev plumbing, and integration coverage for target-local custom lint configs. Co-authored-by: Codex <noreply@openai.com>
1 parent e2d2e51 commit 7e7b596

28 files changed

Lines changed: 2627 additions & 6 deletions

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,13 @@ bazel run @rules_rs//tools/rust_analyzer:gen_rust_project -- --help
130130
See the upstream `rules_rust` rust-analyzer docs for editor setup details:
131131
https://bazelbuild.github.io/rules_rust/rust_analyzer.html#vscode
132132

133+
## Dylint
134+
135+
`rules_rs` supports Bazel-native Dylint checks with target-local custom lint bundles,
136+
so different Rust targets can opt into different project policies without sharing one
137+
workspace-global Dylint config. See [`docs/dylint.md`](docs/dylint.md) for the design,
138+
toolchain requirements, and a worked example.
139+
133140
## Advanced Options
134141

135142
<details>

docs/dylint.md

Lines changed: 224 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rs/BUILD.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ bzl_library(
2020
],
2121
)
2222

23+
bzl_library(
24+
name = "dylint",
25+
srcs = ["dylint.bzl"],
26+
visibility = ["//visibility:public"],
27+
deps = ["//rs/private:dylint"],
28+
)
29+
2330
bzl_library(
2431
name = "rules_rust_reexported_extensions",
2532
srcs = ["rules_rust_reexported_extensions.bzl"],

rs/dylint.bzl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""Public Dylint rules for rules_rs."""
2+
3+
load(
4+
"//rs/private:dylint.bzl",
5+
_dylint_config = "dylint_config",
6+
_dylint_library = "dylint_library",
7+
_dylint_toolchain = "dylint_toolchain",
8+
_rust_dylint = "rust_dylint",
9+
)
10+
11+
dylint_config = _dylint_config
12+
dylint_library = _dylint_library
13+
dylint_toolchain = _dylint_toolchain
14+
rust_dylint = _rust_dylint

rs/dylint/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package(default_visibility = ["//visibility:public"])
2+
3+
toolchain_type(
4+
name = "toolchain_type",
5+
)

rs/private/BUILD.bazel

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("@bazel_lib//:bzl_library.bzl", "bzl_library")
2+
load("@rules_rust//rust:defs.bzl", "rust_binary")
23
load(":all_crate_deps_test.bzl", "all_crate_deps_tests")
34
load(":cfg_parser_test.bzl", "cfg_parser_tests")
45
load(":lint_flags_test.bzl", "lint_flags_tests")
@@ -220,6 +221,22 @@ bzl_library(
220221
deps = ["@rules_rust//rust/private:bzl_lib"],
221222
)
222223

224+
bzl_library(
225+
name = "dylint",
226+
srcs = ["dylint.bzl"],
227+
visibility = ["//rs:__subpackages__"],
228+
deps = [
229+
"@rules_rust//rust/private:bzl_lib",
230+
],
231+
)
232+
233+
rust_binary(
234+
name = "dylint_runner",
235+
srcs = ["dylint_runner.rs"],
236+
edition = "2024",
237+
tags = ["manual"],
238+
)
239+
223240
bzl_library(
224241
name = "resolver",
225242
srcs = ["resolver.bzl"],

0 commit comments

Comments
 (0)