mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
force the doctest rustc thread to share the name of the test
This commit is contained in:
parent
e3bc713e2e
commit
76e33b4eb4
@ -1497,10 +1497,12 @@ fn parse_crate_attrs<'a>(sess: &'a Session, input: &Input) -> PResult<'a, Vec<as
|
||||
}
|
||||
}
|
||||
|
||||
/// Runs `f` in a suitable thread for running `rustc`; returns a
|
||||
/// `Result` with either the return value of `f` or -- if a panic
|
||||
/// occurs -- the panic value.
|
||||
pub fn in_rustc_thread<F, R>(f: F) -> Result<R, Box<dyn Any + Send>>
|
||||
/// Runs `f` in a suitable thread for running `rustc`; returns a `Result` with either the return
|
||||
/// value of `f` or -- if a panic occurs -- the panic value.
|
||||
///
|
||||
/// This version applies the given name to the thread. This is used by rustdoc to ensure consistent
|
||||
/// doctest output across platforms and executions.
|
||||
pub fn in_named_rustc_thread<F, R>(name: String, f: F) -> Result<R, Box<dyn Any + Send>>
|
||||
where F: FnOnce() -> R + Send + 'static,
|
||||
R: Send + 'static,
|
||||
{
|
||||
@ -1564,7 +1566,7 @@ pub fn in_rustc_thread<F, R>(f: F) -> Result<R, Box<dyn Any + Send>>
|
||||
|
||||
// The or condition is added from backward compatibility.
|
||||
if spawn_thread || env::var_os("RUST_MIN_STACK").is_some() {
|
||||
let mut cfg = thread::Builder::new().name("rustc".to_string());
|
||||
let mut cfg = thread::Builder::new().name(name);
|
||||
|
||||
// FIXME: Hacks on hacks. If the env is trying to override the stack size
|
||||
// then *don't* set it explicitly.
|
||||
@ -1580,6 +1582,16 @@ pub fn in_rustc_thread<F, R>(f: F) -> Result<R, Box<dyn Any + Send>>
|
||||
}
|
||||
}
|
||||
|
||||
/// Runs `f` in a suitable thread for running `rustc`; returns a
|
||||
/// `Result` with either the return value of `f` or -- if a panic
|
||||
/// occurs -- the panic value.
|
||||
pub fn in_rustc_thread<F, R>(f: F) -> Result<R, Box<dyn Any + Send>>
|
||||
where F: FnOnce() -> R + Send + 'static,
|
||||
R: Send + 'static,
|
||||
{
|
||||
in_named_rustc_thread("rustc".to_string(), f)
|
||||
}
|
||||
|
||||
/// Get a list of extra command-line flags provided by the user, as strings.
|
||||
///
|
||||
/// This function is used during ICEs to show more information useful for
|
||||
|
@ -550,7 +550,7 @@ impl Collector {
|
||||
debug!("Creating test {}: {}", name, test);
|
||||
self.tests.push(testing::TestDescAndFn {
|
||||
desc: testing::TestDesc {
|
||||
name: testing::DynTestName(name),
|
||||
name: testing::DynTestName(name.clone()),
|
||||
ignore: should_ignore,
|
||||
// compiler failures are test failures
|
||||
should_panic: testing::ShouldPanic::No,
|
||||
@ -560,7 +560,7 @@ impl Collector {
|
||||
let panic = io::set_panic(None);
|
||||
let print = io::set_print(None);
|
||||
match {
|
||||
rustc_driver::in_rustc_thread(move || with_globals(move || {
|
||||
rustc_driver::in_named_rustc_thread(name, move || with_globals(move || {
|
||||
io::set_panic(panic);
|
||||
io::set_print(print);
|
||||
hygiene::set_default_edition(edition);
|
||||
|
Loading…
Reference in New Issue
Block a user