Skip to content

Commit 015eb51

Browse files
Rollup merge of rust-lang#153460 - notriddle:emit-renames, r=fmease
rustdoc: rename `--emit` names These new names are pithier and match up with the rest of our terminology: - `--emit=html-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=html-non-static-files` matches the convention that emit is a noun, not an adjective, and it logically groups with other data formats. 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. CC rust-lang#146220 (comment)
2 parents b2fabe3 + c6b7f63 commit 015eb51

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+
HtmlStaticFiles,
326+
HtmlNonStaticFiles,
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::HtmlStaticFiles),
337+
"invocation-specific" => Ok(Self::HtmlNonStaticFiles),
338+
// modern choices
339+
"html-static-files" => Ok(Self::HtmlStaticFiles),
340+
"html-non-static-files" => Ok(Self::HtmlNonStaticFiles),
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::HtmlNonStaticFiles)
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::HtmlStaticFiles) {
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
@@ -535,7 +535,7 @@ fn opts() -> Vec<RustcOptGroup> {
535535
"",
536536
"emit",
537537
"Comma separated list of types of output for rustdoc to emit",
538-
"[toolchain-shared-resources,invocation-specific,dep-info]",
538+
"[html-static-files,html-non-static-files,dep-info]",
539539
),
540540
opt(Unstable, FlagMulti, "", "no-run", "Compile doctests without running them", ""),
541541
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=html-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=html-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 [html-static-files,html-non-static-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)