Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 58cd70e

Browse files
Only merge doctests starting 2024 edition
1 parent 6ae3524 commit 58cd70e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/librustdoc/doctest.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,10 +732,12 @@ struct CreateRunnableDoctests {
732732
visited_tests: FxHashMap<(String, usize), usize>,
733733
unused_extern_reports: Arc<Mutex<Vec<UnusedExterns>>>,
734734
compiling_test_count: AtomicUsize,
735+
can_merge_doctests: bool,
735736
}
736737

737738
impl CreateRunnableDoctests {
738739
fn new(rustdoc_options: RustdocOptions, opts: GlobalTestOptions) -> CreateRunnableDoctests {
740+
let can_merge_doctests = rustdoc_options.edition >= Edition::Edition2024;
739741
CreateRunnableDoctests {
740742
standalone_tests: Vec::new(),
741743
mergeable_tests: FxHashMap::default(),
@@ -744,6 +746,7 @@ impl CreateRunnableDoctests {
744746
visited_tests: FxHashMap::default(),
745747
unused_extern_reports: Default::default(),
746748
compiling_test_count: AtomicUsize::new(0),
749+
can_merge_doctests,
747750
}
748751
}
749752

@@ -773,7 +776,8 @@ impl CreateRunnableDoctests {
773776
let edition = scraped_test.edition(&self.rustdoc_options);
774777
let doctest =
775778
DocTest::new(&scraped_test.text, Some(&self.opts.crate_name), edition, Some(test_id));
776-
let is_standalone = scraped_test.langstr.compile_fail
779+
let is_standalone = !self.can_merge_doctests
780+
|| scraped_test.langstr.compile_fail
777781
|| scraped_test.langstr.test_harness
778782
|| self.rustdoc_options.nocapture
779783
|| self.rustdoc_options.test_args.iter().any(|arg| arg == "--show-output")

0 commit comments

Comments
 (0)