about summary refs log tree commit diff
path: root/src/librustdoc/doctest/rust.rs
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-04-25 00:53:58 +0200
committerGitHub <noreply@github.com>2025-04-25 00:53:58 +0200
commit610ed826e30c8f89d56275b5a1033de4b3fc4a38 (patch)
treea8a5ef3a5f841c860b2bc14b1ad9660331a293d0 /src/librustdoc/doctest/rust.rs
parent3c877f6a477380ed61155d3bf816df09c9e05b9e (diff)
parent115341f767741ab1584b5daeafc2709a74612f59 (diff)
downloadrust-610ed826e30c8f89d56275b5a1033de4b3fc4a38.tar.gz
rust-610ed826e30c8f89d56275b5a1033de4b3fc4a38.zip
Rollup merge of #137096 - ehuss:stabilize-doctest-xcompile, r=fmease
Stabilize flags for doctest cross compilation

This makes the following changes in preparation for supporting doctest cross-compiling in cargo:

- Renames `--runtool` and `--runtool-arg` to `--test-runtool` and `--test-runtool-arg` to maintain consistency with other `--test-*` arguments.
- Stabilizes the `--test-runtool` and `--test-runtool-arg`. These are needed in order to support cargo's `target.runner` option which specifies a runner to execute a cross-compiled doctest (for example, qemu).
- Stabilizes the `--enable-per-target-ignores` flag by removing it and making it unconditionally enabled. This makes it possible to disable a doctest on a per-target basis, which I think will be helpful for rolling out this feature.

These changes were suggested in https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/stabilizing.20doctest.20xcompile/near/409281127

The intent is to stabilize the doctest-xcompile feature in cargo. This will help ensure that for projects that do cross-compile testing that their doctests are also covered. Currently there is a somewhat surprising behavior that they are ignored.

Closes https://github.com/rust-lang/rust/issues/64245

try-job: x86_64-msvc-1
Diffstat (limited to 'src/librustdoc/doctest/rust.rs')
-rw-r--r--src/librustdoc/doctest/rust.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/librustdoc/doctest/rust.rs b/src/librustdoc/doctest/rust.rs
index be2dea641d7..43dcfab880b 100644
--- a/src/librustdoc/doctest/rust.rs
+++ b/src/librustdoc/doctest/rust.rs
@@ -63,19 +63,18 @@ impl DocTestVisitor for RustCollector {
 pub(super) struct HirCollector<'tcx> {
     codes: ErrorCodes,
     tcx: TyCtxt<'tcx>,
-    enable_per_target_ignores: bool,
     collector: RustCollector,
 }
 
 impl<'tcx> HirCollector<'tcx> {
-    pub fn new(codes: ErrorCodes, enable_per_target_ignores: bool, tcx: TyCtxt<'tcx>) -> Self {
+    pub fn new(codes: ErrorCodes, tcx: TyCtxt<'tcx>) -> Self {
         let collector = RustCollector {
             source_map: tcx.sess.psess.clone_source_map(),
             cur_path: vec![],
             position: DUMMY_SP,
             tests: vec![],
         };
-        Self { codes, enable_per_target_ignores, tcx, collector }
+        Self { codes, tcx, collector }
     }
 
     pub fn collect_crate(mut self) -> Vec<ScrapedDocTest> {
@@ -131,7 +130,6 @@ impl HirCollector<'_> {
                 &doc,
                 &mut self.collector,
                 self.codes,
-                self.enable_per_target_ignores,
                 Some(&crate::html::markdown::ExtraInfo::new(self.tcx, def_id, span)),
             );
         }