Skip to content

Commit efb7457

Browse files
committed
Auto merge of #62733 - ehuss:update-mdbook, r=alexcrichton
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)
2 parents bc2e84c + 04538c6 commit efb7457

File tree

13 files changed

+83
-349
lines changed

13 files changed

+83
-349
lines changed

Cargo.lock

+47-246
Large diffs are not rendered by default.

src/bootstrap/doc.rs

+9-29
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate::cache::{INTERNER, Interned};
2323
use crate::config::Config;
2424

2525
macro_rules! book {
26-
($($name:ident, $path:expr, $book_name:expr, $book_ver:expr;)+) => {
26+
($($name:ident, $path:expr, $book_name:expr;)+) => {
2727
$(
2828
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
2929
pub struct $name {
@@ -49,7 +49,6 @@ macro_rules! book {
4949
builder.ensure(RustbookSrc {
5050
target: self.target,
5151
name: INTERNER.intern_str($book_name),
52-
version: $book_ver,
5352
src: doc_src(builder),
5453
})
5554
}
@@ -61,21 +60,15 @@ macro_rules! book {
6160
// NOTE: When adding a book here, make sure to ALSO build the book by
6261
// adding a build step in `src/bootstrap/builder.rs`!
6362
book!(
64-
EditionGuide, "src/doc/edition-guide", "edition-guide", RustbookVersion::Latest;
65-
EmbeddedBook, "src/doc/embedded-book", "embedded-book", RustbookVersion::Latest;
66-
Nomicon, "src/doc/nomicon", "nomicon", RustbookVersion::Latest;
67-
Reference, "src/doc/reference", "reference", RustbookVersion::MdBook1;
68-
RustByExample, "src/doc/rust-by-example", "rust-by-example", RustbookVersion::Latest;
69-
RustcBook, "src/doc/rustc", "rustc", RustbookVersion::MdBook1;
70-
RustdocBook, "src/doc/rustdoc", "rustdoc", RustbookVersion::Latest;
63+
EditionGuide, "src/doc/edition-guide", "edition-guide";
64+
EmbeddedBook, "src/doc/embedded-book", "embedded-book";
65+
Nomicon, "src/doc/nomicon", "nomicon";
66+
Reference, "src/doc/reference", "reference";
67+
RustByExample, "src/doc/rust-by-example", "rust-by-example";
68+
RustcBook, "src/doc/rustc", "rustc";
69+
RustdocBook, "src/doc/rustdoc", "rustdoc";
7170
);
7271

73-
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
74-
enum RustbookVersion {
75-
MdBook1,
76-
Latest,
77-
}
78-
7972
fn doc_src(builder: &Builder<'_>) -> Interned<PathBuf> {
8073
INTERNER.intern_path(builder.src.join("src/doc"))
8174
}
@@ -108,7 +101,6 @@ impl Step for UnstableBook {
108101
target: self.target,
109102
name: INTERNER.intern_str("unstable-book"),
110103
src: builder.md_doc_out(self.target),
111-
version: RustbookVersion::Latest,
112104
})
113105
}
114106
}
@@ -162,7 +154,6 @@ struct RustbookSrc {
162154
target: Interned<String>,
163155
name: Interned<String>,
164156
src: Interned<PathBuf>,
165-
version: RustbookVersion,
166157
}
167158

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

197-
let vers = match self.version {
198-
RustbookVersion::MdBook1 => "1",
199-
RustbookVersion::Latest => "3",
200-
};
201-
202188
builder.run(rustbook_cmd
203189
.arg("build")
204190
.arg(&src)
205191
.arg("-d")
206-
.arg(out)
207-
.arg("-m")
208-
.arg(vers));
192+
.arg(out));
209193
}
210194
}
211195

@@ -251,7 +235,6 @@ impl Step for TheBook {
251235
builder.ensure(RustbookSrc {
252236
target,
253237
name: INTERNER.intern_string(name.to_string()),
254-
version: RustbookVersion::Latest,
255238
src: doc_src(builder),
256239
});
257240

@@ -261,23 +244,20 @@ impl Step for TheBook {
261244
builder.ensure(RustbookSrc {
262245
target,
263246
name: INTERNER.intern_string(source_name),
264-
version: RustbookVersion::Latest,
265247
src: doc_src(builder),
266248
});
267249

268250
let source_name = format!("{}/second-edition", name);
269251
builder.ensure(RustbookSrc {
270252
target,
271253
name: INTERNER.intern_string(source_name),
272-
version: RustbookVersion::Latest,
273254
src: doc_src(builder),
274255
});
275256

276257
let source_name = format!("{}/2018-edition", name);
277258
builder.ensure(RustbookSrc {
278259
target,
279260
name: INTERNER.intern_string(source_name),
280-
version: RustbookVersion::Latest,
281261
src: doc_src(builder),
282262
});
283263

src/doc/edition-guide

src/doc/nomicon

src/doc/reference

src/doc/rustc/src/codegen-options/index.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,13 @@ This flag allows for creating instrumented binaries that will collect
221221
profiling data for use with profile-guided optimization (PGO). The flag takes
222222
an optional argument which is the path to a directory into which the
223223
instrumented binary will emit the collected data. See the chapter on
224-
[profile-guided optimization](profile-guided-optimization.html) for more
225-
information.
224+
[profile-guided optimization] for more information.
226225

227226
## profile-use
228227

229228
This flag specifies the profiling data file to be used for profile-guided
230229
optimization (PGO). The flag takes a mandatory argument which is the path
231230
to a valid `.profdata` file. See the chapter on
232-
[profile-guided optimization](profile-guided-optimization.html) for more
233-
information.
231+
[profile-guided optimization] for more information.
232+
233+
[profile-guided optimization]: ../profile-guided-optimization.md

src/doc/rustc/src/command-line-arguments.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@ of print values are:
161161

162162
## `-g`: include debug information
163163

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

166166
## `-O`: optimize your code
167167

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

170170
## `-o`: filename of the output
171171

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

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

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

193193
## `-W`: set lint warnings
194194

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

197197
## `-A`: set lint allowed
198198

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

201201
## `-D`: set lint denied
202202

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

205205
## `-F`: set lint forbidden
206206

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

209209
## `-Z`: set unstable options
210210

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

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

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

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

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

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

src/tools/cargo

Submodule cargo updated 99 files

src/tools/rustbook/Cargo.toml

-6
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,5 @@ version = "0.3.0"
1414
default-features = false
1515
features = ["search"]
1616

17-
[dependencies.mdbook_1]
18-
package = "mdbook"
19-
version = "0.1.7"
20-
default-features = false
21-
features = ["search"]
22-
2317
[target.'cfg(all(target_arch = "x86_64", target_os = "linux"))'.dependencies]
2418
mdbook-linkcheck = "0.3.0"

src/tools/rustbook/src/main.rs

+7-48
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ use std::path::{Path, PathBuf};
77

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

10-
use mdbook_1::{MDBook as MDBook1};
11-
use mdbook_1::errors::{Result as Result1};
12-
1310
use mdbook::MDBook;
1411
use mdbook::errors::{Result as Result3};
1512

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

3126
let matches = App::new("rustbook")
3227
.about("Build a book with mdBook")
@@ -36,8 +31,7 @@ fn main() {
3631
.subcommand(SubCommand::with_name("build")
3732
.about("Build the book from the markdown files")
3833
.arg_from_usage(d_message)
39-
.arg_from_usage(dir_message)
40-
.arg_from_usage(vers_message))
34+
.arg_from_usage(dir_message))
4135
.subcommand(SubCommand::with_name("linkcheck")
4236
.about("Run linkcheck with mdBook 3")
4337
.arg_from_usage(dir_message))
@@ -46,33 +40,15 @@ fn main() {
4640
// Check which subcomamnd the user ran...
4741
match matches.subcommand() {
4842
("build", Some(sub_matches)) => {
49-
match sub_matches.value_of("mdbook-vers") {
50-
None | Some("1") => {
51-
if let Err(e) = build_1(sub_matches) {
52-
eprintln!("Error: {}", e);
53-
54-
for cause in e.iter().skip(1) {
55-
eprintln!("\tCaused By: {}", cause);
56-
}
43+
if let Err(e) = build(sub_matches) {
44+
eprintln!("Error: {}", e);
5745

58-
::std::process::exit(101);
59-
}
46+
for cause in e.iter().skip(1) {
47+
eprintln!("\tCaused By: {}", cause);
6048
}
61-
Some("2") | Some("3") => {
62-
if let Err(e) = build(sub_matches) {
63-
eprintln!("Error: {}", e);
6449

65-
for cause in e.iter().skip(1) {
66-
eprintln!("\tCaused By: {}", cause);
67-
}
68-
69-
::std::process::exit(101);
70-
}
71-
}
72-
_ => {
73-
panic!("Invalid mdBook version! Select '1' or '2' or '3'");
74-
}
75-
};
50+
::std::process::exit(101);
51+
}
7652
},
7753
("linkcheck", Some(sub_matches)) => {
7854
if let Err(err) = linkcheck(sub_matches) {
@@ -110,23 +86,6 @@ pub fn linkcheck(_args: &ArgMatches<'_>) -> Result<(), Error> {
11086
Ok(())
11187
}
11288

113-
// Build command implementation
114-
pub fn build_1(args: &ArgMatches<'_>) -> Result1<()> {
115-
let book_dir = get_book_dir(args);
116-
let mut book = MDBook1::load(&book_dir)?;
117-
118-
// Set this to allow us to catch bugs in advance.
119-
book.config.build.create_missing = false;
120-
121-
if let Some(dest_dir) = args.value_of("dest-dir") {
122-
book.config.build.build_dir = PathBuf::from(dest_dir);
123-
}
124-
125-
book.build()?;
126-
127-
Ok(())
128-
}
129-
13089
// Build command implementation
13190
pub fn build(args: &ArgMatches<'_>) -> Result3<()> {
13291
let book_dir = get_book_dir(args);

0 commit comments

Comments
 (0)