Skip to content

Commit 2a1491b

Browse files
committed
rustdoc: rename --emit names
These new names are pithier and match up with the rest of our terminology: - `--emit=static-files` matches the default name of the directory that it actually emits, which is `static.files` (the hyphen is used for emit because every other emit option uses hyphens, but the directory uses a dot because we don't want its name to conflict with a crate). - `--emit=data-files` matches the convention that emit is a noun, not an adjective. This commit changes the docs, but leaves in support for the old names, to break the cycle with cargo and docs.rs. This commit needs merged, then cargo and docs.rs will be updated to use the new names, then, finally, the old names will be removed.
1 parent 64b72a1 commit 2a1491b

5 files changed

Lines changed: 14 additions & 10 deletions

File tree

src/librustdoc/config.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ pub(crate) enum ModuleSorting {
322322

323323
#[derive(Clone, Debug, PartialEq, Eq)]
324324
pub(crate) enum EmitType {
325-
Toolchain,
326-
InvocationSpecific,
325+
StaticFiles,
326+
DataFiles,
327327
DepInfo(Option<OutFileName>),
328328
}
329329

@@ -332,8 +332,12 @@ impl FromStr for EmitType {
332332

333333
fn from_str(s: &str) -> Result<Self, Self::Err> {
334334
match s {
335-
"toolchain-shared-resources" => Ok(Self::Toolchain),
336-
"invocation-specific" => Ok(Self::InvocationSpecific),
335+
// old nightly-only choices that are going away soon
336+
"toolchain-shared-resources" => Ok(Self::StaticFiles),
337+
"invocation-specific" => Ok(Self::DataFiles),
338+
// modern choices
339+
"static-files" => Ok(Self::StaticFiles),
340+
"data-files" => Ok(Self::DataFiles),
337341
"dep-info" => Ok(Self::DepInfo(None)),
338342
option => match option.strip_prefix("dep-info=") {
339343
Some("-") => Ok(Self::DepInfo(Some(OutFileName::Stdout))),
@@ -346,7 +350,7 @@ impl FromStr for EmitType {
346350

347351
impl RenderOptions {
348352
pub(crate) fn should_emit_crate(&self) -> bool {
349-
self.emit.is_empty() || self.emit.contains(&EmitType::InvocationSpecific)
353+
self.emit.is_empty() || self.emit.contains(&EmitType::DataFiles)
350354
}
351355

352356
pub(crate) fn dep_info(&self) -> Option<Option<&OutFileName>> {

src/librustdoc/html/render/write_shared.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ fn write_static_files(
218218
try_err!(fs::write(&dst_path, buffer), &dst_path);
219219
}
220220

221-
if opt.emit.is_empty() || opt.emit.contains(&EmitType::Toolchain) {
221+
if opt.emit.is_empty() || opt.emit.contains(&EmitType::StaticFiles) {
222222
static_files::for_each(|f: &static_files::StaticFile| {
223223
let filename = static_dir.join(f.output_filename());
224224
let contents: &[u8] =

src/librustdoc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ fn opts() -> Vec<RustcOptGroup> {
537537
"",
538538
"emit",
539539
"Comma separated list of types of output for rustdoc to emit",
540-
"[toolchain-shared-resources,invocation-specific,dep-info]",
540+
"[static-files,data-files,dep-info]",
541541
),
542542
opt(Unstable, FlagMulti, "", "no-run", "Compile doctests without running them", ""),
543543
opt(

tests/run-make/emit-shared-files/rmake.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn main() {
3434

3535
rustdoc()
3636
.arg("-Zunstable-options")
37-
.arg("--emit=toolchain-shared-resources")
37+
.arg("--emit=static-files")
3838
.out_dir("toolchain-only")
3939
.arg("--resource-suffix=-xxx")
4040
.args(&["--extend-css", "z.css"])
@@ -68,7 +68,7 @@ fn main() {
6868

6969
rustdoc()
7070
.arg("-Zunstable-options")
71-
.arg("--emit=toolchain-shared-resources")
71+
.arg("--emit=static-files")
7272
.out_dir("all-shared")
7373
.arg("--resource-suffix=-xxx")
7474
.args(&["--extend-css", "z.css"])

tests/run-make/rustdoc-default-output/output-default.stdout

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Options:
150150
--generate-redirect-map
151151
Generate JSON file at the top level instead of
152152
generating HTML redirection files
153-
--emit [toolchain-shared-resources,invocation-specific,dep-info]
153+
--emit [static-files,data-files,dep-info]
154154
Comma separated list of types of output for rustdoc to
155155
emit
156156
--no-run Compile doctests without running them

0 commit comments

Comments
 (0)