diff --git a/Cargo.lock b/Cargo.lock index 4e0e72d3415..93b622627b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1891,6 +1891,10 @@ dependencies = [ "shlex", ] +[[package]] +name = "jsondoclint" +version = "0.1.0" + [[package]] name = "jsonpath_lib" version = "0.2.6" diff --git a/Cargo.toml b/Cargo.toml index 5753730053f..e49fe5e2f63 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,6 +33,7 @@ members = [ "src/tools/unicode-table-generator", "src/tools/expand-yaml-anchors", "src/tools/jsondocck", + "src/tools/jsondoclint", "src/tools/html-checker", "src/tools/bump-stage0", "src/tools/replace-version-placeholder", diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index f61c9583085..9d286ddd6d1 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1341,6 +1341,8 @@ note: if you're sure you want to do this, please open an issue as to why. In the let json_compiler = compiler.with_stage(0); cmd.arg("--jsondocck-path") .arg(builder.ensure(tool::JsonDocCk { compiler: json_compiler, target })); + cmd.arg("--jsondoclint-path") + .arg(builder.ensure(tool::JsonDocLint { compiler: json_compiler, target })); } if mode == "run-make" { diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index c3b04a9bbce..7d4ed24b648 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -376,6 +376,7 @@ bootstrap_tool!( ExpandYamlAnchors, "src/tools/expand-yaml-anchors", "expand-yaml-anchors"; LintDocs, "src/tools/lint-docs", "lint-docs"; JsonDocCk, "src/tools/jsondocck", "jsondocck"; + JsonDocLint, "src/tools/jsondoclint", "jsondoclint"; HtmlChecker, "src/tools/html-checker", "html-checker"; BumpStage0, "src/tools/bump-stage0", "bump-stage0"; ReplaceVersionPlaceholder, "src/tools/replace-version-placeholder", "replace-version-placeholder"; diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 6f17b9e1be9..64df76e2772 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -203,6 +203,9 @@ pub struct Config { /// The jsondocck executable. pub jsondocck_path: Option, + /// The jsondoclint executable. + pub jsondoclint_path: Option, + /// The LLVM `FileCheck` binary path. pub llvm_filecheck: Option, diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 0e2cc52a645..38c7b87fc0d 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -64,6 +64,7 @@ pub fn parse_config(args: Vec) -> Config { .optopt("", "rust-demangler-path", "path to rust-demangler to use in tests", "PATH") .reqopt("", "python", "path to python to use for doc tests", "PATH") .optopt("", "jsondocck-path", "path to jsondocck to use for doc tests", "PATH") + .optopt("", "jsondoclint-path", "path to jsondoclint to use for doc tests", "PATH") .optopt("", "valgrind-path", "path to Valgrind executable for Valgrind tests", "PROGRAM") .optflag("", "force-valgrind", "fail if Valgrind tests cannot be run under Valgrind") .optopt("", "run-clang-based-tests-with", "path to Clang executable", "PATH") @@ -226,6 +227,7 @@ pub fn parse_config(args: Vec) -> Config { rust_demangler_path: matches.opt_str("rust-demangler-path").map(PathBuf::from), python: matches.opt_str("python").unwrap(), jsondocck_path: matches.opt_str("jsondocck-path"), + jsondoclint_path: matches.opt_str("jsondoclint-path"), valgrind_path: matches.opt_str("valgrind-path"), force_valgrind: matches.opt_present("force-valgrind"), run_clang_based_tests_with: matches.opt_str("run-clang-based-tests-with"), diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index e2afa5ef590..9cbb6b7c393 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2572,6 +2572,14 @@ impl<'test> TestCx<'test> { if !res.status.success() { self.fatal_proc_rec("check_missing_items failed!", &res); } + + let res = self.cmd2procres( + Command::new(self.config.jsondoclint_path.as_ref().unwrap()).arg(&json_out), + ); + + if !res.status.success() { + self.fatal_proc_rec("jsondoclint failed!", &res); + } } fn get_lines>( diff --git a/src/tools/jsondoclint/Cargo.toml b/src/tools/jsondoclint/Cargo.toml new file mode 100644 index 00000000000..42bb77fde41 --- /dev/null +++ b/src/tools/jsondoclint/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "jsondoclint" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/tools/jsondoclint/src/main.rs b/src/tools/jsondoclint/src/main.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/src/tools/jsondoclint/src/main.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/triagebot.toml b/triagebot.toml index 4b2dcc246e4..11caedbb959 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -132,6 +132,7 @@ trigger_files = [ "src/etc/htmldocck.py", "src/etc/check_missing_items.py", "src/tools/jsondocck", + "src/tools/jsondoclint", "src/tools/rustdoc-gui", "src/tools/rustdoc-js", "src/tools/rustdoc-themes", @@ -147,6 +148,7 @@ trigger_files = [ "src/rustdoc-json-types", "src/test/rustdoc-json", "src/tools/jsondocck", + "src/tools/jsondoclint", ] [autolabel."T-compiler"]