diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2021-03-25 12:46:35 -0400 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2021-03-25 20:03:44 -0400 |
| commit | f77ebd4ffaea7fc5af49425cafefe141e7458cc3 (patch) | |
| tree | 53c07eb79f74b270df4a919dd6c65aaa1ccfba8a /src/librustdoc/formats | |
| parent | 7c89cc4a6f68a9c544ff1b000c8f7ef1c3535278 (diff) | |
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 https://github.com/rust-lang/docs.rs/issues/1327 by reverting https://github.com/rust-lang/docs.rs/pull/1324. This obsoletes `--print=unversioned-files`, which I plan to remove as soon as docs.rs stops using it.
Diffstat (limited to 'src/librustdoc/formats')
| -rw-r--r-- | src/librustdoc/formats/renderer.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/librustdoc/formats/renderer.rs b/src/librustdoc/formats/renderer.rs index 9dcef3a20d6..f0b390add73 100644 --- a/src/librustdoc/formats/renderer.rs +++ b/src/librustdoc/formats/renderer.rs @@ -58,10 +58,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)]; |
