mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Use consolidated fingerprint directory for rustdoc.
This commit is contained in:
parent
d1c0a9d9ca
commit
77855f3636
@ -598,7 +598,7 @@ fn hash_rustc_version(bcx: &BuildContext<'_, '_>, hasher: &mut StableHasher) {
|
||||
|
||||
/// Returns whether or not this unit should use a metadata hash.
|
||||
fn should_use_metadata(bcx: &BuildContext<'_, '_>, unit: &Unit) -> bool {
|
||||
if unit.mode.is_doc_test() {
|
||||
if unit.mode.is_doc_test() || unit.mode.is_doc() {
|
||||
// Doc tests do not have metadata.
|
||||
return false;
|
||||
}
|
||||
|
@ -863,10 +863,44 @@ fn features() {
|
||||
r#"#[cfg(feature = "bar")] pub fn bar() {}"#,
|
||||
)
|
||||
.build();
|
||||
p.cargo("doc --features foo").run();
|
||||
p.cargo("doc --features foo")
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] bar v0.0.1 [..]
|
||||
[DOCUMENTING] bar v0.0.1 [..]
|
||||
[DOCUMENTING] foo v0.0.1 [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
.run();
|
||||
assert!(p.root().join("target/doc").is_dir());
|
||||
assert!(p.root().join("target/doc/foo/fn.foo.html").is_file());
|
||||
assert!(p.root().join("target/doc/bar/fn.bar.html").is_file());
|
||||
// Check that turning the feature off will remove the files.
|
||||
p.cargo("doc")
|
||||
.with_stderr(
|
||||
"\
|
||||
[COMPILING] bar v0.0.1 [..]
|
||||
[DOCUMENTING] bar v0.0.1 [..]
|
||||
[DOCUMENTING] foo v0.0.1 [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
.run();
|
||||
// assert!(!p.root().join("target/doc/foo/fn.foo.html").is_file());
|
||||
// assert!(!p.root().join("target/doc/bar/fn.bar.html").is_file());
|
||||
// And switching back will rebuild and bring them back.
|
||||
p.cargo("doc --features foo")
|
||||
.with_stderr(
|
||||
"\
|
||||
[DOCUMENTING] bar v0.0.1 [..]
|
||||
[DOCUMENTING] foo v0.0.1 [..]
|
||||
[FINISHED] [..]
|
||||
",
|
||||
)
|
||||
.run();
|
||||
assert!(p.root().join("target/doc/foo/fn.foo.html").is_file());
|
||||
assert!(p.root().join("target/doc/bar/fn.bar.html").is_file());
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
|
Loading…
x
Reference in New Issue
Block a user