Skip to content

Commit a47e09f

Browse files
Fix stage 1 build
1 parent b292354 commit a47e09f

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/librustdoc/doctest.rs

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

0 commit comments

Comments
 (0)