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/html/render/context.rs | |
| parent | 7c89cc4a6f68a9c544ff1b000c8f7ef1c3535278 (diff) | |
| download | rust-f77ebd4ffaea7fc5af49425cafefe141e7458cc3.tar.gz rust-f77ebd4ffaea7fc5af49425cafefe141e7458cc3.zip | |
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/html/render/context.rs')
| -rw-r--r-- | src/librustdoc/html/render/context.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs index 468bd9997a6..17cedeb5a51 100644 --- a/src/librustdoc/html/render/context.rs +++ b/src/librustdoc/html/render/context.rs @@ -288,6 +288,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { ) -> Result<(Self, clean::Crate), Error> { // need to save a copy of the options for rendering the index page let md_opts = options.clone(); + let emit_crate = options.should_emit_crate(); let RenderOptions { output, external_html, @@ -393,7 +394,9 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { let dst = output; scx.ensure_dir(&dst)?; - krate = sources::render(&dst, &mut scx, krate)?; + if emit_crate { + krate = sources::render(&dst, &mut scx, krate)?; + } // Build our search index let index = build_index(&krate, &mut cache, tcx); |
