Skip to content

Commit 4cc12dc

Browse files
Fix stage 1 build
1 parent b292354 commit 4cc12dc

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/librustdoc/doctest.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ mod markdown;
44
mod runner;
55
mod rust;
66

7+
#[cfg(bootstrap)]
8+
use std::fmt;
79
use std::fs::File;
810
use std::hash::{Hash, Hasher};
911
use std::io::{self, Write};
@@ -30,6 +32,7 @@ use rustc_span::symbol::sym;
3032
use rustc_span::{FileName, Span};
3133
use rustc_target::spec::{Target, TargetTuple};
3234
use tempfile::{Builder as TempFileBuilder, TempDir};
35+
#[cfg(not(bootstrap))]
3336
use test::test::{RustdocResult, get_rustdoc_result};
3437
use tracing::debug;
3538

@@ -38,6 +41,37 @@ use crate::config::{Options as RustdocOptions, OutputFormat};
3841
use crate::html::markdown::{ErrorCodes, Ignore, LangString, MdRelLine};
3942
use crate::lint::init_lints;
4043

44+
#[cfg(bootstrap)]
45+
pub enum RustdocResult {
46+
/// The test failed to compile.
47+
CompileError,
48+
/// The test is marked `compile_fail` but compiled successfully.
49+
UnexpectedCompilePass,
50+
/// The test failed to compile (as expected) but the compiler output did not contain all
51+
/// expected error codes.
52+
MissingErrorCodes(Vec<String>),
53+
/// The test binary was unable to be executed.
54+
ExecutionError(io::Error),
55+
/// The test binary exited with a non-zero exit code.
56+
///
57+
/// This typically means an assertion in the test failed or another form of panic occurred.
58+
ExecutionFailure(Output),
59+
/// The test is marked `should_panic` but the test binary executed successfully.
60+
NoPanic(Option<String>),
61+
}
62+
63+
#[cfg(bootstrap)]
64+
impl fmt::Display for RustdocResult {
65+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
66+
Ok(())
67+
}
68+
}
69+
70+
#[cfg(bootstrap)]
71+
fn get_rustdoc_result(_: process::Output, _: bool) -> Result<(), RustdocResult> {
72+
Ok(())
73+
}
74+
4175
/// Type used to display times (compilation and total) information for merged doctests.
4276
struct MergedDoctestTimes {
4377
total_time: Instant,

0 commit comments

Comments
 (0)