diff options
| author | jyn <github@jyn.dev> | 2023-05-25 13:39:10 -0500 |
|---|---|---|
| committer | jyn <github@jyn.dev> | 2023-05-29 13:26:44 -0500 |
| commit | 58e18ddf86e67a1210a60ab4a0ad5e1adfbbc819 (patch) | |
| tree | 42c48cb6d8290ba8f4a6b304660480926208c8b0 /src/bootstrap/builder/tests.rs | |
| parent | cb4b7f631980e6f78a486be46ec653ad322ce12e (diff) | |
| download | rust-58e18ddf86e67a1210a60ab4a0ad5e1adfbbc819.tar.gz rust-58e18ddf86e67a1210a60ab4a0ad5e1adfbbc819.zip | |
Switch doc::{Std, Rustc} to `crate_or_deps`
Previously they were using `all_krates` and various hacks to determine which crates to document. Switch them to `crate_or_deps` so `ShouldRun` tells them which crate to document instead of having to guess. This also makes a few other refactors: - Remove the now unused `all_krates`; new code should only use `crate_or_deps`. - Add tests for documenting Std - Remove the unnecessary `run_cargo_rustdoc_for` closure so that we only run cargo once - Give a more helpful error message when documenting a no_std target - Use `builder.msg` in the Steps instead of `builder.info`
Diffstat (limited to 'src/bootstrap/builder/tests.rs')
| -rw-r--r-- | src/bootstrap/builder/tests.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/bootstrap/builder/tests.rs b/src/bootstrap/builder/tests.rs index edca8fe9b13..d76b830b0e5 100644 --- a/src/bootstrap/builder/tests.rs +++ b/src/bootstrap/builder/tests.rs @@ -1,5 +1,6 @@ use super::*; use crate::config::{Config, DryRun, TargetSelection}; +use crate::doc::DocumentationFormat; use std::thread; fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config { @@ -66,6 +67,16 @@ macro_rules! std { }; } +macro_rules! doc_std { + ($host:ident => $target:ident, stage = $stage:literal) => { + doc::Std::new( + $stage, + TargetSelection::from_user(stringify!($target)), + DocumentationFormat::HTML, + ) + }; +} + macro_rules! rustc { ($host:ident => $target:ident, stage = $stage:literal) => { compile::Rustc::new( @@ -144,6 +155,9 @@ fn alias_and_path_for_library() { first(cache.all::<compile::Std>()), &[std!(A => A, stage = 0), std!(A => A, stage = 1)] ); + + let mut cache = run_build(&["library".into(), "core".into()], configure("doc", &["A"], &["A"])); + assert_eq!(first(cache.all::<doc::Std>()), &[doc_std!(A => A, stage = 0)]); } #[test] |
