Skip to content

Commit

Permalink
Auto merge of #62733 - ehuss:update-mdbook, r=alexcrichton
Browse files Browse the repository at this point in the history
Update mdbook, cargo, books

This updates the last of the books using mdbook 0.1, finally removing it from the build.  Cargo, the reference, and the rustc book were the last to change.  This should have a noticeable impact on CI times.

I decided to remove the version switcher from the rustbook tool.  It seemed a little awkward keeping it with one version.  If we ever need it in the future, we can always add it back, it is a relatively small amount of code.  I would just like to avoid the temptation to split the versions in the future.

## cargo

12 commits in 677a180f4c8ca1dcef594f68dd0e63e4f08621f5..e3563dbdcd2e370bc4f11d080f739d82d25773fd
2019-07-08 13:43:02 +0000 to 2019-07-16 19:22:44 +0000
- Add Cirrus CI badge to manifest (rust-lang/cargo#7119)
- Update mdbook to 0.3. (rust-lang/cargo#7140)
- Remove unused feature filter. (rust-lang/cargo#7131)
- Remove now-unused `WorkspaceResolve` (rust-lang/cargo#7127)
- Fix some clippy warnings. (rust-lang/cargo#7135)
- Also ignore remap-path-prefix in metadata for `cargo rustc`. (rust-lang/cargo#7134)
- Fix some formatting for some strings. (rust-lang/cargo#7129)
- Handle activation conflicts for `[patch]` sources (rust-lang/cargo#7118)
- [BETA] Fix `cargo new` in root directory. (rust-lang/cargo#7126)
- Remove MyFnOnce (rust-lang/cargo#7125)
- Don't suppress error messages with `-q` (rust-lang/cargo#7116)
- Fix changelog date (rust-lang/cargo#7115)

## book

2 commits in 6c0d83499c8e77e06a71d28c5e1adccec278d4f3..7ddc46460f09a5cd9bd2a620565bdc20b3315ea9
2019-06-23 20:25:30 -0400 to 2019-06-27 09:50:36 -0400
- reexport to re-export
- Fixes made in final layout check

## reference

4 commits in 7a5aab5..8e7d614
2019-06-20 17:38:52 +0200 to 2019-07-16 21:02:33 +0100
- Update to mdbook 0.3. (rust-lang/reference#641)
- Remove extra parenthesis (rust-lang/reference#621)
- Correct sentence about unsized coercions (rust-lang/reference#628)
- unions: call out field offset issues (rust-lang/reference#627)

## edition-guide

4 commits in f8072acde5ce29c7570d7986180bbded2d22e287..f6c8b92d4e63edd28e862be952f33861f35956f8
2019-06-14 23:27:05 +0200 to 2019-07-06 22:10:32 +0200
- Fix syntax highlighting in macro guide (rust-lang/edition-guide#182)
- Fix error example for modern compilers. (rust-lang/edition-guide#160)
- Try cargo install-upgrade for mdbook. (rust-lang/edition-guide#181)
- correct the travis build badge URL (rust-lang/edition-guide#180)

## embedded-book

2 commits in ef27b517dcd0b990c888c0d7caeff52a5a115619..ff334e74fdb9f197e621efa6d7c3105be892e888
2019-06-18 22:59:47 +0000 to 2019-07-16 13:47:34 +0000
- use_core() is required for #![no_std] compatible generated bindings  (rust-embedded/book#197)
- concurrency: update shared resource examples  (rust-embedded/book#196)

## nomicon

7 commits in 341c221116a8b9f1010cf1eece952b80c5ec7f54..b7f0aba2f88a8feade70595efcfa3438e54e96c0
2019-06-19 09:08:47 -0700 to 2019-07-11 15:11:36 -0400
- chore: Remove redundant Eq import
- Fix link to rfc1857
- Move word "reading" out of the link to "The Book"
- update the link to `mdbook`
- re-wrap more text
- re-wrap the text to 80 columns
- Better explain how to use `mdbook`

## rust-by-example

8 commits in 62b3ff2cb44dd8b648c3ef2a9347c3706d148014..e3679e214d8db44586aca9b20aa27517007d1923
2019-06-24 09:17:21 -0300 to 2019-07-15 11:13:44 -0300
- Collection of fixes for the 'Vectors` chapter. (rust-lang/rust-by-example#1216)
- Changed mutable collected_iterator into immutable (rust-lang/rust-by-example#1219)
- Fix minor formatting inconsistencies (rust-lang/rust-by-example#1220)
- Make `use` example runnable (rust-lang/rust-by-example#1215)
- Fix: Automatically Typo (rust-lang/rust-by-example#1214)
- Collection of fixes for the `Strings` chapter. (rust-lang/rust-by-example#1212)
- Added link to russian translation (rust-lang/rust-by-example#1213)
- A couple of fixes for the `HashMap` chapter. (rust-lang/rust-by-example#1211)
  • Loading branch information
bors committed Jul 17, 2019
2 parents bc2e84c + 04538c6 commit efb7457
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 349 deletions.
293 changes: 47 additions & 246 deletions Cargo.lock

Large diffs are not rendered by default.

38 changes: 9 additions & 29 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::cache::{INTERNER, Interned};
use crate::config::Config;

macro_rules! book {
($($name:ident, $path:expr, $book_name:expr, $book_ver:expr;)+) => {
($($name:ident, $path:expr, $book_name:expr;)+) => {
$(
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct $name {
Expand All @@ -49,7 +49,6 @@ macro_rules! book {
builder.ensure(RustbookSrc {
target: self.target,
name: INTERNER.intern_str($book_name),
version: $book_ver,
src: doc_src(builder),
})
}
Expand All @@ -61,21 +60,15 @@ macro_rules! book {
// NOTE: When adding a book here, make sure to ALSO build the book by
// adding a build step in `src/bootstrap/builder.rs`!
book!(
EditionGuide, "src/doc/edition-guide", "edition-guide", RustbookVersion::Latest;
EmbeddedBook, "src/doc/embedded-book", "embedded-book", RustbookVersion::Latest;
Nomicon, "src/doc/nomicon", "nomicon", RustbookVersion::Latest;
Reference, "src/doc/reference", "reference", RustbookVersion::MdBook1;
RustByExample, "src/doc/rust-by-example", "rust-by-example", RustbookVersion::Latest;
RustcBook, "src/doc/rustc", "rustc", RustbookVersion::MdBook1;
RustdocBook, "src/doc/rustdoc", "rustdoc", RustbookVersion::Latest;
EditionGuide, "src/doc/edition-guide", "edition-guide";
EmbeddedBook, "src/doc/embedded-book", "embedded-book";
Nomicon, "src/doc/nomicon", "nomicon";
Reference, "src/doc/reference", "reference";
RustByExample, "src/doc/rust-by-example", "rust-by-example";
RustcBook, "src/doc/rustc", "rustc";
RustdocBook, "src/doc/rustdoc", "rustdoc";
);

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
enum RustbookVersion {
MdBook1,
Latest,
}

fn doc_src(builder: &Builder<'_>) -> Interned<PathBuf> {
INTERNER.intern_path(builder.src.join("src/doc"))
}
Expand Down Expand Up @@ -108,7 +101,6 @@ impl Step for UnstableBook {
target: self.target,
name: INTERNER.intern_str("unstable-book"),
src: builder.md_doc_out(self.target),
version: RustbookVersion::Latest,
})
}
}
Expand Down Expand Up @@ -162,7 +154,6 @@ struct RustbookSrc {
target: Interned<String>,
name: Interned<String>,
src: Interned<PathBuf>,
version: RustbookVersion,
}

impl Step for RustbookSrc {
Expand Down Expand Up @@ -194,18 +185,11 @@ impl Step for RustbookSrc {
builder.info(&format!("Rustbook ({}) - {}", target, name));
let _ = fs::remove_dir_all(&out);

let vers = match self.version {
RustbookVersion::MdBook1 => "1",
RustbookVersion::Latest => "3",
};

builder.run(rustbook_cmd
.arg("build")
.arg(&src)
.arg("-d")
.arg(out)
.arg("-m")
.arg(vers));
.arg(out));
}
}

Expand Down Expand Up @@ -251,7 +235,6 @@ impl Step for TheBook {
builder.ensure(RustbookSrc {
target,
name: INTERNER.intern_string(name.to_string()),
version: RustbookVersion::Latest,
src: doc_src(builder),
});

Expand All @@ -261,23 +244,20 @@ impl Step for TheBook {
builder.ensure(RustbookSrc {
target,
name: INTERNER.intern_string(source_name),
version: RustbookVersion::Latest,
src: doc_src(builder),
});

let source_name = format!("{}/second-edition", name);
builder.ensure(RustbookSrc {
target,
name: INTERNER.intern_string(source_name),
version: RustbookVersion::Latest,
src: doc_src(builder),
});

let source_name = format!("{}/2018-edition", name);
builder.ensure(RustbookSrc {
target,
name: INTERNER.intern_string(source_name),
version: RustbookVersion::Latest,
src: doc_src(builder),
});

Expand Down
2 changes: 1 addition & 1 deletion src/doc/edition-guide
2 changes: 1 addition & 1 deletion src/doc/embedded-book
2 changes: 1 addition & 1 deletion src/doc/nomicon
2 changes: 1 addition & 1 deletion src/doc/reference
8 changes: 4 additions & 4 deletions src/doc/rustc/src/codegen-options/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,13 @@ This flag allows for creating instrumented binaries that will collect
profiling data for use with profile-guided optimization (PGO). The flag takes
an optional argument which is the path to a directory into which the
instrumented binary will emit the collected data. See the chapter on
[profile-guided optimization](profile-guided-optimization.html) for more
information.
[profile-guided optimization] for more information.

## profile-use

This flag specifies the profiling data file to be used for profile-guided
optimization (PGO). The flag takes a mandatory argument which is the path
to a valid `.profdata` file. See the chapter on
[profile-guided optimization](profile-guided-optimization.html) for more
information.
[profile-guided optimization] for more information.

[profile-guided optimization]: ../profile-guided-optimization.md
18 changes: 9 additions & 9 deletions src/doc/rustc/src/command-line-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ of print values are:

## `-g`: include debug information

A synonym for `-C debuginfo=2`, for more see [here](codegen-options/index.html#debuginfo).
A synonym for `-C debuginfo=2`, for more see [here](codegen-options/index.md#debuginfo).

## `-O`: optimize your code

A synonym for `-C opt-level=2`, for more see [here](codegen-options/index.html#opt-level).
A synonym for `-C opt-level=2`, for more see [here](codegen-options/index.md#opt-level).

## `-o`: filename of the output

Expand All @@ -188,23 +188,23 @@ and instead produce a test harness.

## `--target`: select a target triple to build

This controls which [target](targets/index.html) to produce.
This controls which [target](targets/index.md) to produce.

## `-W`: set lint warnings

This flag will set which lints should be set to the [warn level](lints/levels.html#warn).
This flag will set which lints should be set to the [warn level](lints/levels.md#warn).

## `-A`: set lint allowed

This flag will set which lints should be set to the [allow level](lints/levels.html#allow).
This flag will set which lints should be set to the [allow level](lints/levels.md#allow).

## `-D`: set lint denied

This flag will set which lints should be set to the [deny level](lints/levels.html#deny).
This flag will set which lints should be set to the [deny level](lints/levels.md#deny).

## `-F`: set lint forbidden

This flag will set which lints should be set to the [forbid level](lints/levels.html#forbid).
This flag will set which lints should be set to the [forbid level](lints/levels.md#forbid).

## `-Z`: set unstable options

Expand All @@ -215,11 +215,11 @@ run: `rustc -Z help`.

## `--cap-lints`: set the most restrictive lint level

This flag lets you 'cap' lints, for more, [see here](lints/levels.html#capping-lints).
This flag lets you 'cap' lints, for more, [see here](lints/levels.md#capping-lints).

## `-C`/`--codegen`: code generation options

This flag will allow you to set [codegen options](codegen-options/index.html).
This flag will allow you to set [codegen options](codegen-options/index.md).

## `-V`/`--version`: print a version

Expand Down
2 changes: 1 addition & 1 deletion src/tools/cargo
Submodule cargo updated 99 files
+1 −1 .travis.yml
+1 −1 CHANGELOG.md
+1 −2 crates/resolver-tests/tests/resolve.rs
+1 −1 src/bin/cargo/cli.rs
+3 −2 src/bin/cargo/commands/install.rs
+1 −2 src/bin/cargo/commands/metadata.rs
+24 −20 src/cargo/core/compiler/context/compilation_files.rs
+0 −6 src/cargo/core/compiler/context/unit_dependencies.rs
+17 −38 src/cargo/core/compiler/fingerprint.rs
+1 −2 src/cargo/core/package.rs
+4 −6 src/cargo/core/registry.rs
+35 −2 src/cargo/core/resolver/context.rs
+5 −11 src/cargo/core/resolver/encode.rs
+8 −3 src/cargo/core/resolver/mod.rs
+4 −1 src/cargo/core/shell.rs
+4 −0 src/cargo/ops/cargo_new.rs
+1 −1 src/cargo/ops/cargo_package.rs
+1 −2 src/cargo/ops/lockfile.rs
+2 −4 src/cargo/ops/registry.rs
+1 −2 src/cargo/sources/directory.rs
+3 −4 src/cargo/util/command_prelude.rs
+1 −2 src/cargo/util/diagnostic_server.rs
+1 −1 src/cargo/util/toml/mod.rs
+1 −1 src/cargo/util/workspace.rs
+1 −1 src/doc/README.md
+5 −4 src/doc/asciidoc-extension.rb
+4 −0 src/doc/book.toml
+12 −12 src/doc/man/generated/cargo-bench.html
+11 −11 src/doc/man/generated/cargo-build.html
+11 −11 src/doc/man/generated/cargo-check.html
+9 −9 src/doc/man/generated/cargo-clean.html
+11 −11 src/doc/man/generated/cargo-doc.html
+7 −7 src/doc/man/generated/cargo-fetch.html
+12 −12 src/doc/man/generated/cargo-fix.html
+7 −7 src/doc/man/generated/cargo-generate-lockfile.html
+1 −1 src/doc/man/generated/cargo-help.html
+7 −7 src/doc/man/generated/cargo-init.html
+10 −10 src/doc/man/generated/cargo-install.html
+5 −5 src/doc/man/generated/cargo-locate-project.html
+6 −6 src/doc/man/generated/cargo-login.html
+7 −7 src/doc/man/generated/cargo-metadata.html
+7 −7 src/doc/man/generated/cargo-new.html
+9 −9 src/doc/man/generated/cargo-owner.html
+11 −11 src/doc/man/generated/cargo-package.html
+6 −6 src/doc/man/generated/cargo-pkgid.html
+15 −15 src/doc/man/generated/cargo-publish.html
+11 −11 src/doc/man/generated/cargo-run.html
+12 −12 src/doc/man/generated/cargo-rustc.html
+11 −11 src/doc/man/generated/cargo-rustdoc.html
+5 −5 src/doc/man/generated/cargo-search.html
+11 −11 src/doc/man/generated/cargo-test.html
+7 −7 src/doc/man/generated/cargo-uninstall.html
+8 −8 src/doc/man/generated/cargo-update.html
+21 −4 src/doc/man/generated/cargo-vendor.html
+6 −6 src/doc/man/generated/cargo-verify-project.html
+1 −1 src/doc/man/generated/cargo-version.html
+8 −8 src/doc/man/generated/cargo-yank.html
+36 −36 src/doc/man/generated/cargo.html
+22 −22 src/doc/src/appendix/glossary.md
+4 −4 src/doc/src/faq.md
+1 −1 src/doc/src/getting-started/first-steps.md
+2 −2 src/doc/src/getting-started/index.md
+2 −2 src/doc/src/guide/cargo-toml-vs-cargo-lock.md
+1 −1 src/doc/src/guide/dependencies.md
+9 −9 src/doc/src/guide/index.md
+1 −1 src/doc/src/guide/project-layout.md
+1 −1 src/doc/src/guide/tests.md
+4 −4 src/doc/src/index.md
+3 −3 src/doc/src/reference/build-scripts.md
+5 −5 src/doc/src/reference/config.md
+5 −5 src/doc/src/reference/environment-variables.md
+10 −10 src/doc/src/reference/index.md
+18 −15 src/doc/src/reference/manifest.md
+8 −8 src/doc/src/reference/publishing.md
+7 −7 src/doc/src/reference/registries.md
+4 −4 src/doc/src/reference/source-replacement.md
+9 −9 src/doc/src/reference/specifying-dependencies.md
+1 −1 src/doc/src/reference/unstable.md
+1 −2 tests/testsuite/bad_config.rs
+8 −16 tests/testsuite/build.rs
+12 −18 tests/testsuite/build_auth.rs
+1 −2 tests/testsuite/build_script.rs
+1 −2 tests/testsuite/cross_compile.rs
+4 −16 tests/testsuite/features.rs
+5 −9 tests/testsuite/fix.rs
+5 −10 tests/testsuite/install.rs
+3 −6 tests/testsuite/new.rs
+59 −0 tests/testsuite/patch.rs
+1 −2 tests/testsuite/path.rs
+1 −1 tests/testsuite/read_manifest.rs
+1 −2 tests/testsuite/run.rs
+5 −10 tests/testsuite/rustc.rs
+15 −6 tests/testsuite/rustflags.rs
+2 −2 tests/testsuite/support/mod.rs
+1 −1 tests/testsuite/support/paths.rs
+2 −11 tests/testsuite/test.rs
+1 −1 tests/testsuite/tool_paths.rs
+2 −2 tests/testsuite/warn_on_failure.rs
+36 −0 tests/testsuite/workspaces.rs
6 changes: 0 additions & 6 deletions src/tools/rustbook/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,5 @@ version = "0.3.0"
default-features = false
features = ["search"]

[dependencies.mdbook_1]
package = "mdbook"
version = "0.1.7"
default-features = false
features = ["search"]

[target.'cfg(all(target_arch = "x86_64", target_os = "linux"))'.dependencies]
mdbook-linkcheck = "0.3.0"
55 changes: 7 additions & 48 deletions src/tools/rustbook/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ use std::path::{Path, PathBuf};

use clap::{App, ArgMatches, SubCommand, AppSettings};

use mdbook_1::{MDBook as MDBook1};
use mdbook_1::errors::{Result as Result1};

use mdbook::MDBook;
use mdbook::errors::{Result as Result3};

Expand All @@ -25,8 +22,6 @@ fn main() {
'The output directory for your book{n}(Defaults to ./book when omitted)'";
let dir_message = "[dir]
'A directory for your book{n}(Defaults to Current Directory when omitted)'";
let vers_message = "-m, --mdbook-vers=[md-version]
'The version of mdbook to use for your book{n}(Defaults to 1 when omitted)'";

let matches = App::new("rustbook")
.about("Build a book with mdBook")
Expand All @@ -36,8 +31,7 @@ fn main() {
.subcommand(SubCommand::with_name("build")
.about("Build the book from the markdown files")
.arg_from_usage(d_message)
.arg_from_usage(dir_message)
.arg_from_usage(vers_message))
.arg_from_usage(dir_message))
.subcommand(SubCommand::with_name("linkcheck")
.about("Run linkcheck with mdBook 3")
.arg_from_usage(dir_message))
Expand All @@ -46,33 +40,15 @@ fn main() {
// Check which subcomamnd the user ran...
match matches.subcommand() {
("build", Some(sub_matches)) => {
match sub_matches.value_of("mdbook-vers") {
None | Some("1") => {
if let Err(e) = build_1(sub_matches) {
eprintln!("Error: {}", e);

for cause in e.iter().skip(1) {
eprintln!("\tCaused By: {}", cause);
}
if let Err(e) = build(sub_matches) {
eprintln!("Error: {}", e);

::std::process::exit(101);
}
for cause in e.iter().skip(1) {
eprintln!("\tCaused By: {}", cause);
}
Some("2") | Some("3") => {
if let Err(e) = build(sub_matches) {
eprintln!("Error: {}", e);

for cause in e.iter().skip(1) {
eprintln!("\tCaused By: {}", cause);
}

::std::process::exit(101);
}
}
_ => {
panic!("Invalid mdBook version! Select '1' or '2' or '3'");
}
};
::std::process::exit(101);
}
},
("linkcheck", Some(sub_matches)) => {
if let Err(err) = linkcheck(sub_matches) {
Expand Down Expand Up @@ -110,23 +86,6 @@ pub fn linkcheck(_args: &ArgMatches<'_>) -> Result<(), Error> {
Ok(())
}

// Build command implementation
pub fn build_1(args: &ArgMatches<'_>) -> Result1<()> {
let book_dir = get_book_dir(args);
let mut book = MDBook1::load(&book_dir)?;

// Set this to allow us to catch bugs in advance.
book.config.build.create_missing = false;

if let Some(dest_dir) = args.value_of("dest-dir") {
book.config.build.build_dir = PathBuf::from(dest_dir);
}

book.build()?;

Ok(())
}

// Build command implementation
pub fn build(args: &ArgMatches<'_>) -> Result3<()> {
let book_dir = get_book_dir(args);
Expand Down

0 comments on commit efb7457

Please sign in to comment.