mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-09 21:42:44 +00:00
Auto merge of #44274 - Mark-Simulacrum:rustdoc-tests, r=alexcrichton
Test rustdoc. Also fixes the broken tests. r? @alexcrichton
This commit is contained in:
commit
f982ff05db
@ -251,9 +251,9 @@ impl<'a> Builder<'a> {
|
|||||||
tool::RustInstaller, tool::Cargo, tool::Rls, tool::Rustdoc, tool::Clippy,
|
tool::RustInstaller, tool::Cargo, tool::Rls, tool::Rustdoc, tool::Clippy,
|
||||||
native::Llvm),
|
native::Llvm),
|
||||||
Kind::Test => describe!(check::Tidy, check::Bootstrap, check::DefaultCompiletest,
|
Kind::Test => describe!(check::Tidy, check::Bootstrap, check::DefaultCompiletest,
|
||||||
check::HostCompiletest, check::Crate, check::CrateLibrustc, check::Linkcheck,
|
check::HostCompiletest, check::Crate, check::CrateLibrustc, check::Rustdoc,
|
||||||
check::Cargotest, check::Cargo, check::Rls, check::Docs, check::ErrorIndex,
|
check::Linkcheck, check::Cargotest, check::Cargo, check::Rls, check::Docs,
|
||||||
check::Distcheck),
|
check::ErrorIndex, check::Distcheck),
|
||||||
Kind::Bench => describe!(check::Crate, check::CrateLibrustc),
|
Kind::Bench => describe!(check::Crate, check::CrateLibrustc),
|
||||||
Kind::Doc => describe!(doc::UnstableBook, doc::UnstableBookGen, doc::TheBook,
|
Kind::Doc => describe!(doc::UnstableBook, doc::UnstableBookGen, doc::TheBook,
|
||||||
doc::Standalone, doc::Std, doc::Test, doc::Rustc, doc::ErrorIndex, doc::Nomicon,
|
doc::Standalone, doc::Std, doc::Test, doc::Rustc, doc::ErrorIndex, doc::Nomicon,
|
||||||
|
@ -900,7 +900,6 @@ impl Step for CrateLibrustc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct Crate {
|
pub struct Crate {
|
||||||
compiler: Compiler,
|
compiler: Compiler,
|
||||||
@ -1080,6 +1079,74 @@ impl Step for Crate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
|
pub struct Rustdoc {
|
||||||
|
host: Interned<String>,
|
||||||
|
test_kind: TestKind,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Step for Rustdoc {
|
||||||
|
type Output = ();
|
||||||
|
const DEFAULT: bool = true;
|
||||||
|
const ONLY_HOSTS: bool = true;
|
||||||
|
|
||||||
|
fn should_run(run: ShouldRun) -> ShouldRun {
|
||||||
|
run.path("src/librustdoc").path("src/tools/rustdoc")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn make_run(run: RunConfig) {
|
||||||
|
let builder = run.builder;
|
||||||
|
|
||||||
|
let test_kind = if builder.kind == Kind::Test {
|
||||||
|
TestKind::Test
|
||||||
|
} else if builder.kind == Kind::Bench {
|
||||||
|
TestKind::Bench
|
||||||
|
} else {
|
||||||
|
panic!("unexpected builder.kind in crate: {:?}", builder.kind);
|
||||||
|
};
|
||||||
|
|
||||||
|
builder.ensure(Rustdoc {
|
||||||
|
host: run.host,
|
||||||
|
test_kind,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fn run(self, builder: &Builder) {
|
||||||
|
let build = builder.build;
|
||||||
|
let test_kind = self.test_kind;
|
||||||
|
|
||||||
|
let compiler = builder.compiler(builder.top_stage, self.host);
|
||||||
|
let target = compiler.host;
|
||||||
|
|
||||||
|
builder.ensure(RemoteCopyLibs { compiler, target });
|
||||||
|
|
||||||
|
let mut cargo = builder.cargo(compiler, Mode::Librustc, target, test_kind.subcommand());
|
||||||
|
compile::rustc_cargo(build, &compiler, target, &mut cargo);
|
||||||
|
let _folder = build.fold_output(|| {
|
||||||
|
format!("{}_stage{}-rustdoc", test_kind.subcommand(), compiler.stage)
|
||||||
|
});
|
||||||
|
println!("{} rustdoc stage{} ({} -> {})", test_kind, compiler.stage,
|
||||||
|
&compiler.host, target);
|
||||||
|
|
||||||
|
if test_kind.subcommand() == "test" && !build.fail_fast {
|
||||||
|
cargo.arg("--no-fail-fast");
|
||||||
|
}
|
||||||
|
|
||||||
|
cargo.arg("-p").arg("rustdoc:0.0.0");
|
||||||
|
|
||||||
|
cargo.arg("--");
|
||||||
|
cargo.args(&build.config.cmd.test_args());
|
||||||
|
|
||||||
|
if build.config.quiet_tests {
|
||||||
|
cargo.arg("--quiet");
|
||||||
|
}
|
||||||
|
|
||||||
|
let _time = util::timeit();
|
||||||
|
|
||||||
|
try_run(build, &mut cargo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn envify(s: &str) -> String {
|
fn envify(s: &str) -> String {
|
||||||
s.chars().map(|c| {
|
s.chars().map(|c| {
|
||||||
match c {
|
match c {
|
||||||
|
@ -7,6 +7,8 @@ build = "build.rs"
|
|||||||
[lib]
|
[lib]
|
||||||
name = "rustdoc"
|
name = "rustdoc"
|
||||||
path = "lib.rs"
|
path = "lib.rs"
|
||||||
|
# SNAP/stage0(cargo)
|
||||||
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
env_logger = { version = "0.4", default-features = false }
|
env_logger = { version = "0.4", default-features = false }
|
||||||
|
@ -15,13 +15,8 @@
|
|||||||
//! the AST (e.g. see all of `clean::inline`), but this is not always a
|
//! the AST (e.g. see all of `clean::inline`), but this is not always a
|
||||||
//! non-lossy transformation. The current format of storage for where clauses
|
//! non-lossy transformation. The current format of storage for where clauses
|
||||||
//! for functions and such is simply a list of predicates. One example of this
|
//! for functions and such is simply a list of predicates. One example of this
|
||||||
//! is that the AST predicate of:
|
//! is that the AST predicate of: `where T: Trait<Foo=Bar>` is encoded as:
|
||||||
//!
|
//! `where T: Trait, <T as Trait>::Foo = Bar`.
|
||||||
//! where T: Trait<Foo=Bar>
|
|
||||||
//!
|
|
||||||
//! is encoded as:
|
|
||||||
//!
|
|
||||||
//! where T: Trait, <T as Trait>::Foo = Bar
|
|
||||||
//!
|
//!
|
||||||
//! This module attempts to reconstruct the original where and/or parameter
|
//! This module attempts to reconstruct the original where and/or parameter
|
||||||
//! bounds by special casing scenarios such as these. Fun!
|
//! bounds by special casing scenarios such as these. Fun!
|
||||||
|
@ -16,10 +16,12 @@
|
|||||||
//! of `fmt::Display`. Example usage:
|
//! of `fmt::Display`. Example usage:
|
||||||
//!
|
//!
|
||||||
//! ```
|
//! ```
|
||||||
//! use rustdoc::html::markdown::Markdown;
|
//! #![feature(rustc_private)]
|
||||||
|
//!
|
||||||
|
//! use rustdoc::html::markdown::{RenderType, Markdown};
|
||||||
//!
|
//!
|
||||||
//! let s = "My *markdown* _text_";
|
//! let s = "My *markdown* _text_";
|
||||||
//! let html = format!("{}", Markdown(s));
|
//! let html = format!("{}", Markdown(s, RenderType::Pulldown));
|
||||||
//! // ... something using html
|
//! // ... something using html
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user