From 1086d9b7b58fea8f15b1f10bc2e527b6fcb0e382 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Wed, 31 Mar 2021 11:35:57 -0400 Subject: [PATCH] Rename CrateSpecific -> InvocationSpecific --- src/librustdoc/config.rs | 6 +++--- src/librustdoc/html/render/write_shared.rs | 14 ++++++------- src/librustdoc/lib.rs | 2 +- src/test/run-make/emit-shared-files/Makefile | 22 ++++++++++---------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index a7a2db621000..246e0ebbb2ba 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -274,7 +274,7 @@ crate struct RenderOptions { crate enum EmitType { Unversioned, Toolchain, - CrateSpecific, + InvocationSpecific, } impl FromStr for EmitType { @@ -285,7 +285,7 @@ impl FromStr for EmitType { match s { "unversioned-shared-resources" => Ok(Unversioned), "toolchain-shared-resources" => Ok(Toolchain), - "crate-specific" => Ok(CrateSpecific), + "invocation-specific" => Ok(InvocationSpecific), _ => Err(()), } } @@ -293,7 +293,7 @@ impl FromStr for EmitType { impl RenderOptions { crate fn should_emit_crate(&self) -> bool { - self.emit.is_empty() || self.emit.contains(&EmitType::CrateSpecific) + self.emit.is_empty() || self.emit.contains(&EmitType::InvocationSpecific) } } diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index b19b29d2fa0d..34994097812c 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -49,10 +49,10 @@ enum SharedResource<'a> { /// /// It has a resource suffix. ToolchainSpecific { basename: &'static str }, - /// This file may change for any crate within a build. + /// This file may change for any crate within a build, or based on the CLI arguments. /// - /// This differs from normal crate-specific files because it has a resource suffix. - CrateSpecific { basename: &'a str }, + /// This differs from normal invocation-specific files because it has a resource suffix. + InvocationSpecific { basename: &'a str }, } impl SharedResource<'_> { @@ -61,7 +61,7 @@ impl SharedResource<'_> { match self { Unversioned { name } | ToolchainSpecific { basename: name } - | CrateSpecific { basename: name } => Path::new(name).extension(), + | InvocationSpecific { basename: name } => Path::new(name).extension(), } } @@ -69,7 +69,7 @@ impl SharedResource<'_> { match self { SharedResource::Unversioned { name } => cx.dst.join(name), SharedResource::ToolchainSpecific { basename } => cx.suffix_path(basename), - SharedResource::CrateSpecific { basename } => cx.suffix_path(basename), + SharedResource::InvocationSpecific { basename } => cx.suffix_path(basename), } } @@ -80,7 +80,7 @@ impl SharedResource<'_> { let kind = match self { SharedResource::Unversioned { .. } => EmitType::Unversioned, SharedResource::ToolchainSpecific { .. } => EmitType::Toolchain, - SharedResource::CrateSpecific { .. } => EmitType::CrateSpecific, + SharedResource::InvocationSpecific { .. } => EmitType::InvocationSpecific, }; emit.contains(&kind) } @@ -165,7 +165,7 @@ pub(super) fn write_shared( // Crate resources should always be dynamic. let write_crate = |p: &_, make_content: &dyn Fn() -> Result, Error>| { let content = make_content()?; - cx.write_shared(SharedResource::CrateSpecific { basename: p }, content, &options.emit) + cx.write_shared(SharedResource::InvocationSpecific { basename: p }, content, &options.emit) }; // Add all the static files. These may already exist, but we just diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index ebdd56611db7..54a6fc625a61 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -532,7 +532,7 @@ fn opts() -> Vec { "", "emit", "Comma separated list of types of output for rustdoc to emit", - "[unversioned-shared-resources,toolchain-shared-resources,crate-specific]", + "[unversioned-shared-resources,toolchain-shared-resources,invocation-specific]", ) }), ] diff --git a/src/test/run-make/emit-shared-files/Makefile b/src/test/run-make/emit-shared-files/Makefile index 952c3aaf5602..66a36dae9d37 100644 --- a/src/test/run-make/emit-shared-files/Makefile +++ b/src/test/run-make/emit-shared-files/Makefile @@ -1,21 +1,21 @@ -include ../../run-make-fulldeps/tools.mk -CRATE_ONLY = $(TMPDIR)/crate-only +INVOCATION_ONLY = $(TMPDIR)/invocation-only TOOLCHAIN_ONLY = $(TMPDIR)/toolchain-only ALL_SHARED = $(TMPDIR)/all-shared -all: crate-only toolchain-only all-shared +all: invocation-only toolchain-only all-shared -crate-only: - $(RUSTDOC) -Z unstable-options --emit=crate-specific --output $(CRATE_ONLY) --resource-suffix=-xxx --theme y.css x.rs - [ -e $(CRATE_ONLY)/search-index-xxx.js ] - [ -e $(CRATE_ONLY)/settings.html ] - [ -e $(CRATE_ONLY)/x/all.html ] - [ -e $(CRATE_ONLY)/x/index.html ] +invocation-only: + $(RUSTDOC) -Z unstable-options --emit=invocation-specific --output $(INVOCATION_ONLY) --resource-suffix=-xxx --theme y.css x.rs + [ -e $(INVOCATION_ONLY)/search-index-xxx.js ] + [ -e $(INVOCATION_ONLY)/settings.html ] + [ -e $(INVOCATION_ONLY)/x/all.html ] + [ -e $(INVOCATION_ONLY)/x/index.html ] # FIXME: this probably shouldn't have a suffix - [ -e $(CRATE_ONLY)/y-xxx.css ] - ! [ -e $(CRATE_ONLY)/storage-xxx.js ] - ! [ -e $(CRATE_ONLY)/SourceSerifPro-It.ttf.woff ] + [ -e $(INVOCATION_ONLY)/y-xxx.css ] + ! [ -e $(INVOCATION_ONLY)/storage-xxx.js ] + ! [ -e $(INVOCATION_ONLY)/SourceSerifPro-It.ttf.woff ] toolchain-only: $(RUSTDOC) -Z unstable-options --emit=toolchain-shared-resources --output $(TOOLCHAIN_ONLY) --resource-suffix=-xxx x.rs