Skip to content

Commit d34ebb4

Browse files
authored
Rollup merge of rust-lang#59747 - gruberb:copy-book-toml-unstable-book, r=ehuss
Copy book.toml unstable book generator Solves rust-lang#59554 and adds a book title to the unstable book. I assume that [copy_recursive](https://github.com/rust-lang/rust/blob/acd8dd6a50d505057a7d7ad8d0d7a4c2bd274200/src/tools/unstable-book-gen/src/main.rs#L105) will take files regardless of their type (`.md` or `.toml`). Although I had a hard time time testing it. A second pair of eyes is definitely needed.
2 parents 056c02e + 34c1572 commit d34ebb4

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

src/doc/unstable-book/book.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[book]
22
title = "The Rust Unstable Book"
3+
author = "The Rust Community"

src/tools/tidy/src/unstable_book.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ use std::fs;
33
use std::path;
44
use crate::features::{collect_lang_features, collect_lib_features, Features, Status};
55

6-
pub const PATH_STR: &str = "doc/unstable-book/src";
6+
pub const PATH_STR: &str = "doc/unstable-book";
77

8-
pub const COMPILER_FLAGS_DIR: &str = "compiler-flags";
8+
pub const COMPILER_FLAGS_DIR: &str = "src/compiler-flags";
99

10-
pub const LANG_FEATURES_DIR: &str = "language-features";
10+
pub const LANG_FEATURES_DIR: &str = "src/language-features";
1111

12-
pub const LIB_FEATURES_DIR: &str = "library-features";
12+
pub const LIB_FEATURES_DIR: &str = "src/library-features";
1313

1414
/// Builds the path to the Unstable Book source directory from the Rust 'src' directory.
1515
pub fn unstable_book_path(base_src_path: &path::Path) -> path::PathBuf {

src/tools/unstable-book-gen/src/main.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn set_to_summary_str(set: &BTreeSet<String>, dir: &str
5252

5353
fn generate_summary(path: &Path, lang_features: &Features, lib_features: &Features) {
5454
let compiler_flags = collect_unstable_book_section_file_names(
55-
&path.join("compiler-flags"));
55+
&path.join("src/compiler-flags"));
5656

5757
let compiler_flags_str = set_to_summary_str(&compiler_flags,
5858
"compiler-flags");
@@ -61,11 +61,11 @@ fn generate_summary(path: &Path, lang_features: &Features, lib_features: &Featur
6161
let unstable_lib_features = collect_unstable_feature_names(&lib_features);
6262

6363
let lang_features_str = set_to_summary_str(&unstable_lang_features,
64-
LANG_FEATURES_DIR);
64+
"language-features");
6565
let lib_features_str = set_to_summary_str(&unstable_lib_features,
66-
LIB_FEATURES_DIR);
66+
"library-features");
6767

68-
let mut file = t!(File::create(&path.join("SUMMARY.md")));
68+
let mut file = t!(File::create(&path.join("src/SUMMARY.md")));
6969
t!(file.write_fmt(format_args!(include_str!("SUMMARY.md"),
7070
compiler_flags = compiler_flags_str,
7171
language_features = lang_features_str,
@@ -102,8 +102,8 @@ fn generate_unstable_book_files(src :&Path, out: &Path, features :&Features) {
102102
}
103103
}
104104

105-
fn copy_recursive(path: &Path, to: &Path) {
106-
for entry in t!(fs::read_dir(path)) {
105+
fn copy_recursive(from: &Path, to: &Path) {
106+
for entry in t!(fs::read_dir(from)) {
107107
let e = t!(entry);
108108
let t = t!(e.metadata());
109109
let dest = &to.join(e.file_name());
@@ -120,7 +120,7 @@ fn main() {
120120
let src_path_str = env::args_os().skip(1).next().expect("source path required");
121121
let dest_path_str = env::args_os().skip(2).next().expect("destination path required");
122122
let src_path = Path::new(&src_path_str);
123-
let dest_path = Path::new(&dest_path_str).join("src");
123+
let dest_path = Path::new(&dest_path_str);
124124

125125
let lang_features = collect_lang_features(src_path, &mut false);
126126
let lib_features = collect_lib_features(src_path).into_iter().filter(|&(ref name, _)| {

0 commit comments

Comments
 (0)