mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Fix doc collision for lib/bin with a dash in the inferred name.
This commit is contained in:
parent
9e7d6e3122
commit
3adb796e87
@ -198,7 +198,9 @@ impl<'a> UnitGenerator<'a, '_> {
|
|||||||
.filter(|t| {
|
.filter(|t| {
|
||||||
t.documented()
|
t.documented()
|
||||||
&& (!t.is_bin()
|
&& (!t.is_bin()
|
||||||
|| !targets.iter().any(|l| l.is_lib() && l.name() == t.name()))
|
|| !targets
|
||||||
|
.iter()
|
||||||
|
.any(|l| l.is_lib() && l.crate_name() == t.crate_name()))
|
||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
@ -488,30 +488,16 @@ fn doc_lib_bin_same_name_with_dash() {
|
|||||||
.file("src/main.rs", "fn main() {}")
|
.file("src/main.rs", "fn main() {}")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("doc")
|
p.cargo("doc")
|
||||||
.with_stderr_unordered(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
warning: output filename collision.
|
|
||||||
The bin target `foo-bar` in package `foo-bar v1.0.0 ([ROOT]/foo)` has the same \
|
|
||||||
output filename as the lib target `foo_bar` in package `foo-bar v1.0.0 ([ROOT]/foo)`.
|
|
||||||
Colliding filename is: [ROOT]/foo/target/doc/foo_bar/index.html
|
|
||||||
The output filenames should be unique.
|
|
||||||
This is a known bug where multiple crates with the same name use
|
|
||||||
the same path; see <https://github.com/rust-lang/cargo/issues/6313>.
|
|
||||||
If this looks unexpected, it may be a bug in Cargo. Please file a bug report at
|
|
||||||
https://github.com/rust-lang/cargo/issues/ with as much information as you
|
|
||||||
can provide.
|
|
||||||
cargo [..]
|
|
||||||
First unit: [..]
|
|
||||||
Second unit: [..]
|
|
||||||
[CHECKING] foo-bar v1.0.0 ([ROOT]/foo)
|
|
||||||
[DOCUMENTING] foo-bar v1.0.0 ([ROOT]/foo)
|
[DOCUMENTING] foo-bar v1.0.0 ([ROOT]/foo)
|
||||||
[FINISHED] [..]
|
[FINISHED] [..]
|
||||||
[GENERATED] [ROOT]/foo/target/doc/foo_bar/index.html and 1 other file
|
[GENERATED] [ROOT]/foo/target/doc/foo_bar/index.html
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
.run();
|
.run();
|
||||||
assert!(p.build_dir().join("doc/foo_bar/index.html").exists());
|
assert!(p.build_dir().join("doc/foo_bar/index.html").exists());
|
||||||
assert!(p.build_dir().join("doc/foo_bar/fn.main.html").exists());
|
assert!(!p.build_dir().join("doc/foo_bar/fn.main.html").exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user