diff options
| author | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-06-10 15:51:35 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume.gomez@huawei.com> | 2024-08-13 20:14:53 +0200 |
| commit | 58cd70e062566eac07987fd1351599fb82c09098 (patch) | |
| tree | 2cf8bc3d4a9ecf5d85fc8a70233adeaecd923352 | |
| parent | 6ae35248358f1e9ac4e2535ceeb160dc1927a720 (diff) | |
| download | rust-58cd70e062566eac07987fd1351599fb82c09098.tar.gz rust-58cd70e062566eac07987fd1351599fb82c09098.zip | |
Only merge doctests starting 2024 edition
| -rw-r--r-- | src/librustdoc/doctest.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index bfe5c9767b9..aba2af35f7b 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -732,10 +732,12 @@ struct CreateRunnableDoctests { visited_tests: FxHashMap<(String, usize), usize>, unused_extern_reports: Arc<Mutex<Vec<UnusedExterns>>>, compiling_test_count: AtomicUsize, + can_merge_doctests: bool, } impl CreateRunnableDoctests { fn new(rustdoc_options: RustdocOptions, opts: GlobalTestOptions) -> CreateRunnableDoctests { + let can_merge_doctests = rustdoc_options.edition >= Edition::Edition2024; CreateRunnableDoctests { standalone_tests: Vec::new(), mergeable_tests: FxHashMap::default(), @@ -744,6 +746,7 @@ impl CreateRunnableDoctests { visited_tests: FxHashMap::default(), unused_extern_reports: Default::default(), compiling_test_count: AtomicUsize::new(0), + can_merge_doctests, } } @@ -773,7 +776,8 @@ impl CreateRunnableDoctests { let edition = scraped_test.edition(&self.rustdoc_options); let doctest = DocTest::new(&scraped_test.text, Some(&self.opts.crate_name), edition, Some(test_id)); - let is_standalone = scraped_test.langstr.compile_fail + let is_standalone = !self.can_merge_doctests + || scraped_test.langstr.compile_fail || scraped_test.langstr.test_harness || self.rustdoc_options.nocapture || self.rustdoc_options.test_args.iter().any(|arg| arg == "--show-output") |
