diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md index 26985e67abb6e..9799f60c2802b 100644 --- a/src/doc/rustdoc/src/unstable-features.md +++ b/src/doc/rustdoc/src/unstable-features.md @@ -502,6 +502,15 @@ Calculating code examples follows these rules: * typedef 2. If one of the previously listed items has a code example, then it'll be counted. +If you use the `-o` option with it, it will generate the file into the given older name. For example: + +```shell +rustdoc foo.rs --show-coverage -o doc +``` + +Will generate a `foo.txt` into the `doc` folder. If the `-o` option isn't passed, it will display +on stdout. + ### JSON output When using `--output-format json` with this option, it will display the coverage information in diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/calculate_doc_coverage.rs similarity index 81% rename from src/librustdoc/passes/calculate_doc_coverage.rs rename to src/librustdoc/calculate_doc_coverage.rs index adf98afc46cc0..ae05e362f2383 100644 --- a/src/librustdoc/passes/calculate_doc_coverage.rs +++ b/src/librustdoc/calculate_doc_coverage.rs @@ -1,6 +1,8 @@ //! Calculates information used for the --show-coverage flag. use std::collections::BTreeMap; +use std::fs::{File, create_dir_all}; +use std::io::{self, BufWriter, Write, stdout}; use std::ops; use rustc_hir as hir; @@ -10,27 +12,39 @@ use rustc_span::{FileName, RemapPathScopeComponents}; use serde::Serialize; use tracing::debug; -use crate::clean; -use crate::config::OutputFormat; +use crate::config::{OutputFormat, RenderOptions}; use crate::core::DocContext; +use crate::docfs::PathError; +use crate::error::Error; use crate::html::markdown::{ErrorCodes, find_testable_code}; -use crate::passes::Pass; -use crate::passes::check_doc_test_visibility::{Tests, should_have_doc_example}; +use crate::passes::{Tests, should_have_doc_example}; use crate::visit::DocVisitor; - -pub(crate) const CALCULATE_DOC_COVERAGE: Pass = Pass { - name: "calculate-doc-coverage", - run: Some(calculate_doc_coverage), - description: "counts the number of items with and without documentation", -}; - -fn calculate_doc_coverage(krate: clean::Crate, ctx: &mut DocContext<'_>) -> clean::Crate { +use crate::{clean, try_err}; + +pub(crate) fn run( + krate: &clean::Crate, + ctx: &mut DocContext<'_>, + options: &RenderOptions, +) -> Result<(), Error> { + let is_json = ctx.output_format == OutputFormat::CoverageJson; + let tcx = ctx.tcx; let mut calc = CoverageCalculator { items: Default::default(), ctx }; calc.visit_crate(&krate); - calc.print_results(); - - krate + if options.output_to_stdout { + calc.print_results(BufWriter::new(stdout().lock())) + .map_err(|error| Error::new(error, "")) + } else { + let out_dir = &options.output; + try_err!(create_dir_all(out_dir), out_dir); + let name = krate.name(tcx); + let mut out_file = out_dir.join(name.as_str()); + out_file.set_extension(if is_json { "json" } else { "txt" }); + let buf = try_err!(File::create_buffered(&out_file), out_file); + calc.print_results(buf).map_err(|error| Error::new(error, &out_file))?; + println!("Generated output into {out_file:?}"); + Ok(()) + } } #[derive(Default, Copy, Clone, Serialize, Debug)] @@ -130,62 +144,66 @@ impl CoverageCalculator<'_, '_> { .expect("failed to convert JSON data to string") } - fn print_results(&self) { + fn print_results(&self, mut buf: impl Write) -> io::Result<()> { let output_format = self.ctx.output_format; if output_format == OutputFormat::CoverageJson { - println!("{}", self.to_json()); - return; + return writeln!(buf, "{}", self.to_json()); } let mut total = ItemCount::default(); - fn print_table_line() { - println!("+-{0:->35}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+", ""); + fn print_table_line(buf: &mut impl Write) -> io::Result<()> { + writeln!(buf, "+-{0:->35}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+-{0:->10}-+", "") } fn print_table_record( + buf: &mut impl Write, name: &str, count: ItemCount, percentage: f64, examples_percentage: f64, - ) { - println!( + ) -> io::Result<()> { + writeln!( + buf, "| {name:<35} | {with_docs:>10} | {percentage:>9.1}% | {with_examples:>10} | \ - {examples_percentage:>9.1}% |", + {examples_percentage:>9.1}% |", with_docs = count.with_docs, with_examples = count.with_examples, - ); + ) } - print_table_line(); - println!( + print_table_line(&mut buf)?; + writeln!( + buf, "| {:<35} | {:>10} | {:>10} | {:>10} | {:>10} |", "File", "Documented", "Percentage", "Examples", "Percentage", - ); - print_table_line(); + )?; + print_table_line(&mut buf)?; for (file, &count) in &self.items { if let Some(percentage) = count.percentage() { print_table_record( + &mut buf, &limit_filename_len( file.display(RemapPathScopeComponents::COVERAGE).to_string(), ), count, percentage, count.examples_percentage().unwrap_or(0.), - ); + )?; total += count; } } - print_table_line(); + print_table_line(&mut buf)?; print_table_record( + &mut buf, "Total", total, total.percentage().unwrap_or(0.0), total.examples_percentage().unwrap_or(0.0), - ); - print_table_line(); + )?; + print_table_line(&mut buf) } } diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 840f9d025c3cf..0a3cbf537e5f1 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -726,7 +726,14 @@ impl Options { output_to_stdout = out_dir == "-"; PathBuf::from(out_dir) } - (None, None) => PathBuf::from("doc"), + (None, None) => { + if show_coverage { + // If no `-o` option is given and we're in the `--show-coverage` mode, by + // default we print on the stdout. + output_to_stdout = true; + } + PathBuf::from("doc") + } }; let cfgs = matches.opt_strs("cfg"); diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index c1ae5f977cb89..af1024580c544 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -452,6 +452,13 @@ pub(crate) fn run_global_ctxt( } } + if show_coverage + && let Err(error) = crate::calculate_doc_coverage::run(&krate, &mut ctxt, &render_options) + { + eprintln!("{error}"); + std::process::exit(1); + } + tcx.sess.time("check_lint_expectations", || tcx.check_expectations(Some(sym::rustdoc))); krate = diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index be830cad6c735..0fadd78fd30b1 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -105,6 +105,7 @@ macro_rules! map { }} } +mod calculate_doc_coverage; mod clean; mod config; mod core; @@ -955,14 +956,14 @@ fn main_args(early_dcx: &mut EarlyDiagCtxt, at_args: &[String]) { return scrape_examples::run(krate, render_opts, cache, tcx, options, bin_crate); } - cache.crate_version = crate_version; - if show_coverage { // if we ran coverage, bail early, we don't need to also generate docs at this point // (also we didn't load in any of the useful passes) return; } + cache.crate_version = crate_version; + rustc_interface::passes::emit_delayed_lints(tcx); if render_opts.dep_info().is_some() { diff --git a/src/librustdoc/passes/mod.rs b/src/librustdoc/passes/mod.rs index 18e1afaf8a242..725c2be4e2121 100644 --- a/src/librustdoc/passes/mod.rs +++ b/src/librustdoc/passes/mod.rs @@ -30,14 +30,13 @@ pub(crate) mod collect_intra_doc_links; pub(crate) use self::collect_intra_doc_links::COLLECT_INTRA_DOC_LINKS; mod check_doc_test_visibility; -pub(crate) use self::check_doc_test_visibility::CHECK_DOC_TEST_VISIBILITY; +pub(crate) use self::check_doc_test_visibility::{ + CHECK_DOC_TEST_VISIBILITY, Tests, should_have_doc_example, +}; mod collect_trait_impls; pub(crate) use self::collect_trait_impls::COLLECT_TRAIT_IMPLS; -mod calculate_doc_coverage; -pub(crate) use self::calculate_doc_coverage::CALCULATE_DOC_COVERAGE; - mod lint; pub(crate) use self::lint::RUN_LINTS; @@ -81,7 +80,6 @@ pub(crate) const PASSES: &[Pass] = &[ PROPAGATE_STABILITY, COLLECT_INTRA_DOC_LINKS, COLLECT_TRAIT_IMPLS, - CALCULATE_DOC_COVERAGE, RUN_LINTS, ]; @@ -103,7 +101,6 @@ pub(crate) const DEFAULT_PASSES: &[ConditionalPass] = &[ pub(crate) const COVERAGE_PASSES: &[ConditionalPass] = &[ ConditionalPass::new(STRIP_HIDDEN, WhenNotDocumentHidden), ConditionalPass::new(STRIP_PRIVATE, WhenNotDocumentPrivate), - ConditionalPass::always(CALCULATE_DOC_COVERAGE), ]; impl ConditionalPass { diff --git a/tests/run-make/rustdoc-show-coverage/foo.rs b/tests/run-make/rustdoc-show-coverage/foo.rs new file mode 100644 index 0000000000000..4892b4ce1ae69 --- /dev/null +++ b/tests/run-make/rustdoc-show-coverage/foo.rs @@ -0,0 +1,5 @@ +pub struct Bar; + +impl Bar { + pub fn foo() {} +} diff --git a/tests/run-make/rustdoc-show-coverage/rmake.rs b/tests/run-make/rustdoc-show-coverage/rmake.rs new file mode 100644 index 0000000000000..90ad50267b8ad --- /dev/null +++ b/tests/run-make/rustdoc-show-coverage/rmake.rs @@ -0,0 +1,58 @@ +// This test ensures that `-o` option works as expected with `--show-coverage`. +// Regression test for . + +//@ needs-target-std +// To not have to deal with windows paths: +//@ only-linux + +use run_make_support::rfs::{read_to_string, remove_file}; +use run_make_support::{path, rustdoc}; + +fn run_rustdoc(extra_args: &[&str]) -> String { + rustdoc() + .input("foo.rs") + .arg("-Zunstable-options") + .arg("--show-coverage") + .args(extra_args) + .run() + .stdout_utf8() +} + +fn check_print_stdout(extra_args: &[&str], stdout_check: &str) { + let out = run_rustdoc(extra_args); + + // By default, it shouldn't have created a `doc` folder. + assert!(!path("doc").exists(), "`doc` folder created with {extra_args:?}"); + // It should have display its output on stdout. + assert!(out.starts_with(stdout_check), "{out:?} doesn't start with {stdout_check:?}"); +} + +fn check_generate_file(ext: &str, extra_args: &[&str], file_check: &str) { + let mut args = extra_args.to_vec(); + args.push("-o"); + args.push("doc"); + let out = run_rustdoc(&args); + + // By default, it shouldn't have created a `doc` folder. + assert!(path("doc").exists(), "`doc` folder not created with {args:?}"); + let file = format!("doc/foo.{ext}"); + assert!(path(&file).exists()); + + let expected = format!("Generated output into {file:?}\n"); + assert_eq!(out, expected, "Expected {expected:?}, got {out:?}"); + + let content = read_to_string(&file); + assert!(content.starts_with(file_check), "{content:?} doesn't start with {file_check:?}"); + remove_file(file); +} + +fn main() { + check_print_stdout(&[], "+-"); + check_print_stdout(&["-o", "-"], "+-"); + check_print_stdout(&["--output-format=json"], "{"); + check_print_stdout(&["--output-format=json", "-o", "-"], "{"); + + // Now we check that it works with "-o something". + check_generate_file("txt", &[], "+-"); + check_generate_file("json", &["--output-format=json"], "{"); +} diff --git a/tests/rustdoc-ui/coverage/allow_missing_docs.rs b/tests/rustdoc-ui/coverage/allow_missing_docs.rs index 43f0d731fdea0..feca5a1bfe3e9 100644 --- a/tests/rustdoc-ui/coverage/allow_missing_docs.rs +++ b/tests/rustdoc-ui/coverage/allow_missing_docs.rs @@ -1,4 +1,4 @@ -//@ compile-flags:-Z unstable-options --show-coverage +//@ compile-flags:-Z unstable-options --show-coverage -o - //@ check-pass //! Make sure to have some docs on your crate root diff --git a/tests/rustdoc-ui/coverage/basic.rs b/tests/rustdoc-ui/coverage/basic.rs index febcc80fbbb50..fc44f6826cb9c 100644 --- a/tests/rustdoc-ui/coverage/basic.rs +++ b/tests/rustdoc-ui/coverage/basic.rs @@ -1,4 +1,4 @@ -//@ compile-flags:-Z unstable-options --show-coverage +//@ compile-flags:-Z unstable-options --show-coverage -o - //@ check-pass #![feature(extern_types)] diff --git a/tests/rustdoc-ui/coverage/doc-examples-json.rs b/tests/rustdoc-ui/coverage/doc-examples-json.rs index 4aa4bf23771d9..bfec2600cb875 100644 --- a/tests/rustdoc-ui/coverage/doc-examples-json.rs +++ b/tests/rustdoc-ui/coverage/doc-examples-json.rs @@ -1,5 +1,5 @@ //@ check-pass -//@ compile-flags:-Z unstable-options --output-format json --show-coverage +//@ compile-flags:-Z unstable-options --output-format json --show-coverage -o - // This check ensures that only one doc example is counted since they're "optional" on // certain items. diff --git a/tests/rustdoc-ui/coverage/doc-examples.rs b/tests/rustdoc-ui/coverage/doc-examples.rs index 283d9c424aa19..dd8969f934ee2 100644 --- a/tests/rustdoc-ui/coverage/doc-examples.rs +++ b/tests/rustdoc-ui/coverage/doc-examples.rs @@ -1,4 +1,4 @@ -//@ compile-flags:-Z unstable-options --show-coverage +//@ compile-flags:-Z unstable-options --show-coverage -o - //@ check-pass //! This test ensure that only rust code examples are counted. diff --git a/tests/rustdoc-ui/doctest-output.rs b/tests/rustdoc-ui/coverage/doctest-output.rs similarity index 100% rename from tests/rustdoc-ui/doctest-output.rs rename to tests/rustdoc-ui/coverage/doctest-output.rs diff --git a/tests/rustdoc-ui/doctest-output.stderr b/tests/rustdoc-ui/coverage/doctest-output.stderr similarity index 100% rename from tests/rustdoc-ui/doctest-output.stderr rename to tests/rustdoc-ui/coverage/doctest-output.stderr diff --git a/tests/rustdoc-ui/coverage/empty.rs b/tests/rustdoc-ui/coverage/empty.rs index bcd3e48988b15..fd9f1e617fbec 100644 --- a/tests/rustdoc-ui/coverage/empty.rs +++ b/tests/rustdoc-ui/coverage/empty.rs @@ -1,4 +1,4 @@ -//@ compile-flags:-Z unstable-options --show-coverage +//@ compile-flags:-Z unstable-options --show-coverage -o - //@ check-pass // an empty crate still has one item to document: the crate root diff --git a/tests/rustdoc-ui/coverage/enum-tuple-documented.rs b/tests/rustdoc-ui/coverage/enum-tuple-documented.rs index 4cbeb7a164da1..9e88e896f8da7 100644 --- a/tests/rustdoc-ui/coverage/enum-tuple-documented.rs +++ b/tests/rustdoc-ui/coverage/enum-tuple-documented.rs @@ -1,4 +1,4 @@ -//@ compile-flags:-Z unstable-options --show-coverage +//@ compile-flags:-Z unstable-options --show-coverage -o - //@ check-pass // The point of this test is to ensure that the number of "documented" items diff --git a/tests/rustdoc-ui/coverage/enum-tuple.rs b/tests/rustdoc-ui/coverage/enum-tuple.rs index 5cbc52a7d033f..25d3c9f57bafe 100644 --- a/tests/rustdoc-ui/coverage/enum-tuple.rs +++ b/tests/rustdoc-ui/coverage/enum-tuple.rs @@ -1,4 +1,4 @@ -//@ compile-flags:-Z unstable-options --show-coverage +//@ compile-flags:-Z unstable-options --show-coverage -o - //@ check-pass //! (remember the crate root is still a module) diff --git a/tests/rustdoc-ui/coverage/enums.rs b/tests/rustdoc-ui/coverage/enums.rs index 29e4198457610..bdb213c2a53b7 100644 --- a/tests/rustdoc-ui/coverage/enums.rs +++ b/tests/rustdoc-ui/coverage/enums.rs @@ -1,4 +1,4 @@ -//@ compile-flags:-Z unstable-options --show-coverage +//@ compile-flags:-Z unstable-options --show-coverage -o - //@ check-pass //! (remember the crate root is still a module) diff --git a/tests/rustdoc-ui/coverage/exotic.rs b/tests/rustdoc-ui/coverage/exotic.rs index 9fc1498cb2a3a..2beb890b21926 100644 --- a/tests/rustdoc-ui/coverage/exotic.rs +++ b/tests/rustdoc-ui/coverage/exotic.rs @@ -1,4 +1,4 @@ -//@ compile-flags:-Z unstable-options --show-coverage +//@ compile-flags:-Z unstable-options --show-coverage -o - //@ check-pass #![feature(rustdoc_internals)] diff --git a/tests/rustdoc-ui/coverage/json.rs b/tests/rustdoc-ui/coverage/json.rs index bfa8dc7008305..dcab7df252249 100644 --- a/tests/rustdoc-ui/coverage/json.rs +++ b/tests/rustdoc-ui/coverage/json.rs @@ -1,5 +1,5 @@ //@ check-pass -//@ compile-flags:-Z unstable-options --output-format json --show-coverage +//@ compile-flags:-Z unstable-options --output-format json --show-coverage -o - pub mod foo { /// Hello! diff --git a/tests/rustdoc-ui/output-format-coveragejson-emit-depinfo.rs b/tests/rustdoc-ui/coverage/output-format-coveragejson-emit-depinfo.rs similarity index 71% rename from tests/rustdoc-ui/output-format-coveragejson-emit-depinfo.rs rename to tests/rustdoc-ui/coverage/output-format-coveragejson-emit-depinfo.rs index 0609b515e5ca8..97cdedecb0aaf 100644 --- a/tests/rustdoc-ui/output-format-coveragejson-emit-depinfo.rs +++ b/tests/rustdoc-ui/coverage/output-format-coveragejson-emit-depinfo.rs @@ -1,2 +1,2 @@ -//@ compile-flags: --show-coverage --output-format=json --emit=dep-info -Zunstable-options +//@ compile-flags: --show-coverage --output-format=json --emit=dep-info -Zunstable-options -o - //@ build-pass diff --git a/tests/rustdoc-ui/output-format-coveragejson-emit-depinfo.stdout b/tests/rustdoc-ui/coverage/output-format-coveragejson-emit-depinfo.stdout similarity index 100% rename from tests/rustdoc-ui/output-format-coveragejson-emit-depinfo.stdout rename to tests/rustdoc-ui/coverage/output-format-coveragejson-emit-depinfo.stdout diff --git a/tests/rustdoc-ui/output-format-json-emit-html.html_non_static.stderr b/tests/rustdoc-ui/coverage/output-format-json-emit-html.html_non_static.stderr similarity index 100% rename from tests/rustdoc-ui/output-format-json-emit-html.html_non_static.stderr rename to tests/rustdoc-ui/coverage/output-format-json-emit-html.html_non_static.stderr diff --git a/tests/rustdoc-ui/output-format-json-emit-html.html_non_static_coverage.stderr b/tests/rustdoc-ui/coverage/output-format-json-emit-html.html_non_static_coverage.stderr similarity index 100% rename from tests/rustdoc-ui/output-format-json-emit-html.html_non_static_coverage.stderr rename to tests/rustdoc-ui/coverage/output-format-json-emit-html.html_non_static_coverage.stderr diff --git a/tests/rustdoc-ui/output-format-json-emit-html.html_static.stderr b/tests/rustdoc-ui/coverage/output-format-json-emit-html.html_static.stderr similarity index 100% rename from tests/rustdoc-ui/output-format-json-emit-html.html_static.stderr rename to tests/rustdoc-ui/coverage/output-format-json-emit-html.html_static.stderr diff --git a/tests/rustdoc-ui/output-format-json-emit-html.html_static_coverage.stderr b/tests/rustdoc-ui/coverage/output-format-json-emit-html.html_static_coverage.stderr similarity index 100% rename from tests/rustdoc-ui/output-format-json-emit-html.html_static_coverage.stderr rename to tests/rustdoc-ui/coverage/output-format-json-emit-html.html_static_coverage.stderr diff --git a/tests/rustdoc-ui/output-format-json-emit-html.rs b/tests/rustdoc-ui/coverage/output-format-json-emit-html.rs similarity index 100% rename from tests/rustdoc-ui/output-format-json-emit-html.rs rename to tests/rustdoc-ui/coverage/output-format-json-emit-html.rs diff --git a/tests/rustdoc-ui/coverage/private.rs b/tests/rustdoc-ui/coverage/private.rs index 91490eff7a8d5..3b78c5d761dbc 100644 --- a/tests/rustdoc-ui/coverage/private.rs +++ b/tests/rustdoc-ui/coverage/private.rs @@ -1,4 +1,4 @@ -//@ compile-flags:-Z unstable-options --show-coverage --document-private-items +//@ compile-flags:-Z unstable-options --show-coverage --document-private-items -o - //@ check-pass #![allow(unused)] diff --git a/tests/rustdoc-ui/show-coverage-json-emit-html-non-static.rs b/tests/rustdoc-ui/coverage/show-coverage-json-emit-html-non-static.rs similarity index 100% rename from tests/rustdoc-ui/show-coverage-json-emit-html-non-static.rs rename to tests/rustdoc-ui/coverage/show-coverage-json-emit-html-non-static.rs diff --git a/tests/rustdoc-ui/show-coverage-json-emit-html-non-static.stderr b/tests/rustdoc-ui/coverage/show-coverage-json-emit-html-non-static.stderr similarity index 100% rename from tests/rustdoc-ui/show-coverage-json-emit-html-non-static.stderr rename to tests/rustdoc-ui/coverage/show-coverage-json-emit-html-non-static.stderr diff --git a/tests/rustdoc-ui/show-coverage-json.rs b/tests/rustdoc-ui/coverage/show-coverage-json.rs similarity index 91% rename from tests/rustdoc-ui/show-coverage-json.rs rename to tests/rustdoc-ui/coverage/show-coverage-json.rs index 3851e34fe3599..e7ddc69d79f8a 100644 --- a/tests/rustdoc-ui/show-coverage-json.rs +++ b/tests/rustdoc-ui/coverage/show-coverage-json.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Z unstable-options --show-coverage --output-format=json +//@ compile-flags: -Z unstable-options --show-coverage --output-format=json -o - //@ check-pass mod bar { diff --git a/tests/rustdoc-ui/show-coverage-json.stdout b/tests/rustdoc-ui/coverage/show-coverage-json.stdout similarity index 100% rename from tests/rustdoc-ui/show-coverage-json.stdout rename to tests/rustdoc-ui/coverage/show-coverage-json.stdout diff --git a/tests/rustdoc-ui/show-coverage.rs b/tests/rustdoc-ui/coverage/show-coverage.rs similarity index 68% rename from tests/rustdoc-ui/show-coverage.rs rename to tests/rustdoc-ui/coverage/show-coverage.rs index 00bb1606a82cb..1f9c3a8f805b7 100644 --- a/tests/rustdoc-ui/show-coverage.rs +++ b/tests/rustdoc-ui/coverage/show-coverage.rs @@ -1,4 +1,4 @@ -//@ compile-flags: -Z unstable-options --show-coverage +//@ compile-flags: -Z unstable-options --show-coverage -o - //@ check-pass mod bar { diff --git a/tests/rustdoc-ui/show-coverage.stdout b/tests/rustdoc-ui/coverage/show-coverage.stdout similarity index 90% rename from tests/rustdoc-ui/show-coverage.stdout rename to tests/rustdoc-ui/coverage/show-coverage.stdout index b9e0316545e77..42c17f8bbd696 100644 --- a/tests/rustdoc-ui/show-coverage.stdout +++ b/tests/rustdoc-ui/coverage/show-coverage.stdout @@ -1,7 +1,7 @@ +-------------------------------------+------------+------------+------------+------------+ | File | Documented | Percentage | Examples | Percentage | +-------------------------------------+------------+------------+------------+------------+ -| ...ests/rustdoc-ui/show-coverage.rs | 1 | 50.0% | 1 | 100.0% | +| ...doc-ui/coverage/show-coverage.rs | 1 | 50.0% | 1 | 100.0% | +-------------------------------------+------------+------------+------------+------------+ | Total | 1 | 50.0% | 1 | 100.0% | +-------------------------------------+------------+------------+------------+------------+ diff --git a/tests/rustdoc-ui/coverage/statics-consts.rs b/tests/rustdoc-ui/coverage/statics-consts.rs index 85cc23847396e..5177673f7958a 100644 --- a/tests/rustdoc-ui/coverage/statics-consts.rs +++ b/tests/rustdoc-ui/coverage/statics-consts.rs @@ -1,4 +1,4 @@ -//@ compile-flags:-Z unstable-options --show-coverage +//@ compile-flags:-Z unstable-options --show-coverage -o - //@ check-pass //! gotta make sure we can count statics and consts correctly, too diff --git a/tests/rustdoc-ui/coverage/traits.rs b/tests/rustdoc-ui/coverage/traits.rs index 89044369e6a77..37e147004d714 100644 --- a/tests/rustdoc-ui/coverage/traits.rs +++ b/tests/rustdoc-ui/coverage/traits.rs @@ -1,4 +1,4 @@ -//@ compile-flags:-Z unstable-options --show-coverage +//@ compile-flags:-Z unstable-options --show-coverage -o - //@ check-pass #![feature(trait_alias)] diff --git a/tests/rustdoc-ui/issues/issue-91713.stdout b/tests/rustdoc-ui/issues/issue-91713.stdout index e7b8a1dccf802..0243f6cd533a0 100644 --- a/tests/rustdoc-ui/issues/issue-91713.stdout +++ b/tests/rustdoc-ui/issues/issue-91713.stdout @@ -8,7 +8,6 @@ strip-aliased-non-local - strips all non-local private aliased items from the ou propagate-stability - propagates stability to child items collect-intra-doc-links - resolves intra-doc links collect-trait-impls - retrieves trait impls for items in the crate -calculate-doc-coverage - counts the number of items with and without documentation run-lints - runs some of rustdoc's lints Default passes for rustdoc: @@ -26,4 +25,3 @@ collect-intra-doc-links Passes run with `--show-coverage`: strip-hidden (when not --document-hidden-items) strip-private (when not --document-private-items) -calculate-doc-coverage