Skip to content

Commit 04538c6

Browse files
committed
Update mdbook, cargo, books
This updates the last of the books using mdbook 0.1, finally removing it from the build.
1 parent 2eb0bc5 commit 04538c6

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)