Skip to content

Commit 1daaf68

Browse files
committed
Update tests if scraping is only on nightly
1 parent 9e7a5ed commit 1daaf68

12 files changed

+54
-164
lines changed

src/cargo/core/compiler/unit_dependencies.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,15 +712,14 @@ fn compute_deps_doc(
712712
if state.ws.unit_needs_doc_scrape(unit) {
713713
for scrape_unit in state.scrape_units.iter() {
714714
deps_of(scrape_unit, state, unit_for)?;
715-
ret.push(new_unit_dep_with_profile(
715+
ret.push(new_unit_dep(
716716
state,
717717
scrape_unit,
718718
&scrape_unit.pkg,
719719
&scrape_unit.target,
720720
unit_for,
721721
scrape_unit.kind,
722722
scrape_unit.mode,
723-
scrape_unit.profile.clone(),
724723
IS_NO_ARTIFACT_DEP,
725724
)?);
726725
}

src/cargo/core/manifest.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -808,12 +808,13 @@ impl Target {
808808
self.inner.edition
809809
}
810810
pub fn doc_scrape_examples(&self) -> bool {
811-
self.inner.doc_scrape_examples.unwrap_or_else(|| {
812-
matches!(
813-
self.kind(),
814-
TargetKind::Lib(..) | TargetKind::ExampleBin | TargetKind::ExampleLib(..)
815-
)
816-
})
811+
!self.for_host()
812+
&& self.inner.doc_scrape_examples.unwrap_or_else(|| {
813+
matches!(
814+
self.kind(),
815+
TargetKind::Lib(..) | TargetKind::ExampleBin | TargetKind::ExampleLib(..)
816+
)
817+
})
817818
}
818819
pub fn benched(&self) -> bool {
819820
self.inner.benched

tests/testsuite/artifact_dep.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
use cargo_test_support::compare::match_exact;
55
use cargo_test_support::registry::Package;
66
use cargo_test_support::{
7-
basic_bin_manifest, basic_manifest, cross_compile, project, publish, registry, rustc_host,
8-
Project,
7+
basic_bin_manifest, basic_manifest, cross_compile, is_nightly, project, publish, registry,
8+
rustc_host, Project,
99
};
1010

1111
#[cargo_test]
@@ -1991,6 +1991,11 @@ target = "target""#,
19911991

19921992
#[cargo_test]
19931993
fn doc_lib_true() {
1994+
if !is_nightly() {
1995+
// nightly rustdoc invokes scrape examples, which is not stable
1996+
return;
1997+
}
1998+
19941999
let p = project()
19952000
.file(
19962001
"Cargo.toml",
@@ -2019,6 +2024,7 @@ fn doc_lib_true() {
20192024
"\
20202025
[COMPILING] bar v0.0.1 ([CWD]/bar)
20212026
[DOCUMENTING] bar v0.0.1 ([CWD]/bar)
2027+
[SCRAPING] foo v0.0.1 ([CWD])
20222028
[DOCUMENTING] foo v0.0.1 ([CWD])
20232029
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
20242030
",
@@ -2046,6 +2052,11 @@ fn doc_lib_true() {
20462052

20472053
#[cargo_test]
20482054
fn rustdoc_works_on_libs_with_artifacts_and_lib_false() {
2055+
if !is_nightly() {
2056+
// nightly rustdoc invokes scrape examples, which is not stable
2057+
return;
2058+
}
2059+
20492060
let p = project()
20502061
.file(
20512062
"Cargo.toml",
@@ -2094,6 +2105,7 @@ fn rustdoc_works_on_libs_with_artifacts_and_lib_false() {
20942105
.with_stderr(
20952106
"\
20962107
[COMPILING] bar v0.5.0 ([CWD]/bar)
2108+
[SCRAPING] foo v0.0.1 ([CWD])
20972109
[DOCUMENTING] foo v0.0.1 ([CWD])
20982110
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
20992111
",

tests/testsuite/build_script.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,8 +1317,6 @@ fn testing_and_such() {
13171317
p.cargo("doc -v")
13181318
.with_stderr(
13191319
"\
1320-
[SCRAPING] foo v0.5.0 ([CWD])
1321-
[RUNNING] `rustdoc [..]`
13221320
[DOCUMENTING] foo v0.5.0 ([CWD])
13231321
[RUNNING] `rustdoc [..]`
13241322
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]

tests/testsuite/collisions.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ fn collision_doc_multiple_versions() {
199199
[CHECKING] bar v1.0.0
200200
[DOCUMENTING] bar v2.0.0
201201
[FINISHED] [..]
202-
[SCRAPING] foo v0.1.0 [..]
203202
[DOCUMENTING] foo v0.1.0 [..]
204203
",
205204
)
@@ -379,7 +378,6 @@ fn collision_doc_profile_split() {
379378
[CHECKING] common v1.0.0
380379
[DOCUMENTING] common v1.0.0
381380
[DOCUMENTING] pm v0.1.0 [..]
382-
[SCRAPING] foo v0.1.0 [..]
383381
[DOCUMENTING] foo v0.1.0 [..]
384382
[FINISHED] [..]
385383
",
@@ -426,7 +424,6 @@ the same path; see <https://github.com/rust-lang/cargo/issues/6313>.
426424
[DOCUMENTING] bar v1.0.0 [..]
427425
[DOCUMENTING] bar v1.0.0
428426
[CHECKING] bar v1.0.0
429-
[SCRAPING] foo v0.1.0 [..]
430427
[DOCUMENTING] foo v0.1.0 [..]
431428
[FINISHED] [..]
432429
",
@@ -541,7 +538,6 @@ the same path; see <https://github.com/rust-lang/cargo/issues/6313>.
541538
[CHECKING] foo-macro v1.0.0
542539
[DOCUMENTING] foo-macro v1.0.0
543540
[CHECKING] abc v1.0.0 [..]
544-
[SCRAPING] foo-macro v1.0.0 [..]
545541
[DOCUMENTING] foo-macro v1.0.0 [..]
546542
[DOCUMENTING] abc v1.0.0 [..]
547543
[FINISHED] [..]

0 commit comments

Comments
 (0)