about summary refs log tree commit diff
path: root/src/librustdoc/formats/renderer.rs
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2021-04-02 19:57:30 +0200
committerGitHub <noreply@github.com>2021-04-02 19:57:30 +0200
commit31f532092c4172ba2f3764d3ef63a790ea1387e3 (patch)
tree8cdf1e3c47e3aa2795b1ce4c1db951ee2b15d3e9 /src/librustdoc/formats/renderer.rs
parent48ebad58b2d1c07769d8bcaae076f760151fefd5 (diff)
parent413938d7a9df4efe800552fa03ce1a5866539cbc (diff)
downloadrust-31f532092c4172ba2f3764d3ef63a790ea1387e3.tar.gz
rust-31f532092c4172ba2f3764d3ef63a790ea1387e3.zip
Rollup merge of #83478 - jyn514:fine-grained-files, r=Mark-Simulacrum
rustdoc: Add unstable option to only emit shared/crate-specific files

The intended use case is for docs.rs, which can now copy exactly the
files it cares about, rather than having to guess based on whether they
have a resource suffix or not. In particular, some files have a resource
suffix but cannot be shared between crates: https://github.com/rust-lang/docs.rs/pull/1312#issuecomment-798783688

The end goal is to fix rust-lang/docs.rs#1327 by reverting rust-lang/docs.rs#1324.

This obsoletes `--print=unversioned-files`, which I plan to remove as
soon as docs.rs stops using it.

I recommend reviewing this one commit at a time.

r? ``@GuillaumeGomez`` cc ``@Nemo157`` ``@pietroalbini``
Diffstat (limited to 'src/librustdoc/formats/renderer.rs')
-rw-r--r--src/librustdoc/formats/renderer.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/librustdoc/formats/renderer.rs b/src/librustdoc/formats/renderer.rs
index 4e0f3a4e3c3..ae97cd64fb5 100644
--- a/src/librustdoc/formats/renderer.rs
+++ b/src/librustdoc/formats/renderer.rs
@@ -63,10 +63,15 @@ crate fn run_format<'tcx, T: FormatRenderer<'tcx>>(
 ) -> Result<(), Error> {
     let prof = &tcx.sess.prof;
 
+    let emit_crate = options.should_emit_crate();
     let (mut format_renderer, krate) = prof
         .extra_verbose_generic_activity("create_renderer", T::descr())
         .run(|| T::init(krate, options, edition, cache, tcx))?;
 
+    if !emit_crate {
+        return Ok(());
+    }
+
     // Render the crate documentation
     let crate_name = krate.name;
     let mut work = vec![(format_renderer.make_child_renderer(), krate.module)];