|
7 | 7 | //! Everything here is basically just a shim around calling either `rustbook` or
|
8 | 8 | //! `rustdoc`.
|
9 | 9 |
|
10 |
| -use std::collections::HashSet; |
11 | 10 | use std::fs;
|
12 | 11 | use std::io;
|
13 | 12 | use std::path::{Path, PathBuf};
|
@@ -604,32 +603,22 @@ impl Step for Rustc {
|
604 | 603 | cargo.rustdocflag("--extern-html-root-url");
|
605 | 604 | cargo.rustdocflag("ena=https://docs.rs/ena/latest/");
|
606 | 605 |
|
607 |
| - let mut compiler_crates = HashSet::new(); |
608 |
| - |
609 |
| - if paths.is_empty() { |
610 |
| - // Find dependencies for top level crates. |
611 |
| - for root_crate in &["rustc_driver", "rustc_codegen_llvm", "rustc_codegen_ssa"] { |
612 |
| - compiler_crates.extend( |
613 |
| - builder |
614 |
| - .in_tree_crates(root_crate, Some(target)) |
615 |
| - .into_iter() |
616 |
| - .map(|krate| krate.name), |
617 |
| - ); |
618 |
| - } |
| 606 | + let root_crates = if paths.is_empty() { |
| 607 | + vec![ |
| 608 | + INTERNER.intern_str("rustc_driver"), |
| 609 | + INTERNER.intern_str("rustc_codegen_llvm"), |
| 610 | + INTERNER.intern_str("rustc_codegen_ssa"), |
| 611 | + ] |
619 | 612 | } else {
|
620 |
| - for root_crate_path in paths { |
621 |
| - let root_crate = builder.crate_paths[root_crate_path]; |
622 |
| - compiler_crates.extend( |
623 |
| - builder |
624 |
| - .in_tree_crates(&root_crate, Some(target)) |
625 |
| - .into_iter() |
626 |
| - .map(|krate| krate.name), |
627 |
| - ); |
628 |
| - } |
629 |
| - } |
| 613 | + paths.into_iter().map(|p| builder.crate_paths[p]).collect() |
| 614 | + }; |
| 615 | + // Find dependencies for top level crates. |
| 616 | + let compiler_crates = root_crates.iter().flat_map(|krate| { |
| 617 | + builder.in_tree_crates(krate, Some(target)).into_iter().map(|krate| krate.name) |
| 618 | + }); |
630 | 619 |
|
631 | 620 | let mut to_open = None;
|
632 |
| - for krate in &compiler_crates { |
| 621 | + for krate in compiler_crates { |
633 | 622 | // Create all crate output directories first to make sure rustdoc uses
|
634 | 623 | // relative links.
|
635 | 624 | // FIXME: Cargo should probably do this itself.
|
|
0 commit comments