Auto merge of #99066 - est31:remove_box_librustdoc, r=jsha

Remove most box syntax from librustdoc

This is the second attempt after the librustdoc specific changes have been reverted from #87781 in #89134, due to a minor, but exant regression caused by the changes. ~~There have been some changes to librustdoc in the past and maybe thanks to them there is no regression any more. If there is still a regression, one can investigate further and maybe find ways to fix the regressions. Thus, i request a perf run.~~ Edit: turns out there is still a regression, but it's caused only by a subset of the changes. So I've changed this PR to only contains the changes that don't cause any performance regressions, keeping the regression causing changes for a later PR.
This commit is contained in:
bors
2022-07-13 08:29:57 +00:00
8 changed files with 47 additions and 39 deletions

View File

@@ -103,7 +103,7 @@ pub(crate) fn run(options: RustdocOptions) -> Result<(), ErrorGuaranteed> {
diagnostic_output: DiagnosticOutput::Default,
lint_caps,
parse_sess_created: None,
register_lints: Some(box crate::lint::register_lints),
register_lints: Some(Box::new(crate::lint::register_lints)),
override_queries: None,
make_codegen_backend: None,
registry: rustc_driver::diagnostics_registry(),
@@ -556,7 +556,7 @@ pub(crate) fn make_test(
.supports_color();
let emitter = EmitterWriter::new(
box io::sink(),
Box::new(io::sink()),
None,
None,
fallback_bundle,
@@ -568,7 +568,7 @@ pub(crate) fn make_test(
);
// FIXME(misdreavus): pass `-Z treat-err-as-bug` to the doctest parser
let handler = Handler::with_emitter(false, None, box emitter);
let handler = Handler::with_emitter(false, None, Box::new(emitter));
let sess = ParseSess::with_span_handler(handler, sm);
let mut found_main = false;
@@ -1032,7 +1032,7 @@ impl Tester for Collector {
if let Err(err) = std::fs::create_dir_all(&path) {
eprintln!("Couldn't create directory for doctest executables: {}", err);
panic::resume_unwind(box ());
panic::resume_unwind(Box::new(()));
}
DirState::Perm(path)
@@ -1061,7 +1061,7 @@ impl Tester for Collector {
no_run,
test_type: test::TestType::DocTest,
},
testfn: test::DynTestFn(box move || {
testfn: test::DynTestFn(Box::new(move || {
let report_unused_externs = |uext| {
unused_externs.lock().unwrap().push(uext);
};
@@ -1132,9 +1132,9 @@ impl Tester for Collector {
}
}
panic::resume_unwind(box ());
panic::resume_unwind(Box::new(()));
}
}),
})),
});
}