Skip to content

Commit 2506aa0

Browse files
committed
jsondoclint: New Tool
1 parent c97922d commit 2506aa0

File tree

10 files changed

+32
-0
lines changed

10 files changed

+32
-0
lines changed

Cargo.lock

+4
Original file line numberDiff line numberDiff line change
@@ -1891,6 +1891,10 @@ dependencies = [
18911891
"shlex",
18921892
]
18931893

1894+
[[package]]
1895+
name = "jsondoclint"
1896+
version = "0.1.0"
1897+
18941898
[[package]]
18951899
name = "jsonpath_lib"
18961900
version = "0.2.6"

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ members = [
3333
"src/tools/unicode-table-generator",
3434
"src/tools/expand-yaml-anchors",
3535
"src/tools/jsondocck",
36+
"src/tools/jsondoclint",
3637
"src/tools/html-checker",
3738
"src/tools/bump-stage0",
3839
"src/tools/replace-version-placeholder",

src/bootstrap/test.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1341,6 +1341,8 @@ note: if you're sure you want to do this, please open an issue as to why. In the
13411341
let json_compiler = compiler.with_stage(0);
13421342
cmd.arg("--jsondocck-path")
13431343
.arg(builder.ensure(tool::JsonDocCk { compiler: json_compiler, target }));
1344+
cmd.arg("--jsondoclint-path")
1345+
.arg(builder.ensure(tool::JsonDocLint { compiler: json_compiler, target }));
13441346
}
13451347

13461348
if mode == "run-make" {

src/bootstrap/tool.rs

+1
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ bootstrap_tool!(
376376
ExpandYamlAnchors, "src/tools/expand-yaml-anchors", "expand-yaml-anchors";
377377
LintDocs, "src/tools/lint-docs", "lint-docs";
378378
JsonDocCk, "src/tools/jsondocck", "jsondocck";
379+
JsonDocLint, "src/tools/jsondoclint", "jsondoclint";
379380
HtmlChecker, "src/tools/html-checker", "html-checker";
380381
BumpStage0, "src/tools/bump-stage0", "bump-stage0";
381382
ReplaceVersionPlaceholder, "src/tools/replace-version-placeholder", "replace-version-placeholder";

src/tools/compiletest/src/common.rs

+3
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ pub struct Config {
203203
/// The jsondocck executable.
204204
pub jsondocck_path: Option<String>,
205205

206+
/// The jsondoclint executable.
207+
pub jsondoclint_path: Option<String>,
208+
206209
/// The LLVM `FileCheck` binary path.
207210
pub llvm_filecheck: Option<PathBuf>,
208211

src/tools/compiletest/src/main.rs

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
6464
.optopt("", "rust-demangler-path", "path to rust-demangler to use in tests", "PATH")
6565
.reqopt("", "python", "path to python to use for doc tests", "PATH")
6666
.optopt("", "jsondocck-path", "path to jsondocck to use for doc tests", "PATH")
67+
.optopt("", "jsondoclint-path", "path to jsondoclint to use for doc tests", "PATH")
6768
.optopt("", "valgrind-path", "path to Valgrind executable for Valgrind tests", "PROGRAM")
6869
.optflag("", "force-valgrind", "fail if Valgrind tests cannot be run under Valgrind")
6970
.optopt("", "run-clang-based-tests-with", "path to Clang executable", "PATH")
@@ -226,6 +227,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
226227
rust_demangler_path: matches.opt_str("rust-demangler-path").map(PathBuf::from),
227228
python: matches.opt_str("python").unwrap(),
228229
jsondocck_path: matches.opt_str("jsondocck-path"),
230+
jsondoclint_path: matches.opt_str("jsondoclint-path"),
229231
valgrind_path: matches.opt_str("valgrind-path"),
230232
force_valgrind: matches.opt_present("force-valgrind"),
231233
run_clang_based_tests_with: matches.opt_str("run-clang-based-tests-with"),

src/tools/compiletest/src/runtest.rs

+8
Original file line numberDiff line numberDiff line change
@@ -2572,6 +2572,14 @@ impl<'test> TestCx<'test> {
25722572
if !res.status.success() {
25732573
self.fatal_proc_rec("check_missing_items failed!", &res);
25742574
}
2575+
2576+
let res = self.cmd2procres(
2577+
Command::new(self.config.jsondoclint_path.as_ref().unwrap()).arg(&json_out),
2578+
);
2579+
2580+
if !res.status.success() {
2581+
self.fatal_proc_rec("jsondoclint failed!", &res);
2582+
}
25752583
}
25762584

25772585
fn get_lines<P: AsRef<Path>>(

src/tools/jsondoclint/Cargo.toml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "jsondoclint"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]

src/tools/jsondoclint/src/main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn main() {}

triagebot.toml

+2
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ trigger_files = [
132132
"src/etc/htmldocck.py",
133133
"src/etc/check_missing_items.py",
134134
"src/tools/jsondocck",
135+
"src/tools/jsondoclint",
135136
"src/tools/rustdoc-gui",
136137
"src/tools/rustdoc-js",
137138
"src/tools/rustdoc-themes",
@@ -147,6 +148,7 @@ trigger_files = [
147148
"src/rustdoc-json-types",
148149
"src/test/rustdoc-json",
149150
"src/tools/jsondocck",
151+
"src/tools/jsondoclint",
150152
]
151153

152154
[autolabel."T-compiler"]

0 commit comments

Comments
 (0)