mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Adjust warning for rustdoc filename collision.
This commit is contained in:
parent
6aca041592
commit
5d98fca89f
@ -412,9 +412,13 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
|
||||
"Consider changing their names to be unique or compiling them separately.\n\
|
||||
This may become a hard error in the future; see \
|
||||
<https://github.com/rust-lang/cargo/issues/6313>.";
|
||||
let rustdoc_suggestion =
|
||||
"This is a known bug where multiple crates with the same name use\n\
|
||||
the same path; see <https://github.com/rust-lang/cargo/issues/6313>.";
|
||||
let report_collision = |unit: &Unit<'_>,
|
||||
other_unit: &Unit<'_>,
|
||||
path: &PathBuf|
|
||||
path: &PathBuf,
|
||||
suggestion: &str|
|
||||
-> CargoResult<()> {
|
||||
if unit.target.name() == other_unit.target.name() {
|
||||
self.bcx.config.shell().warn(format!(
|
||||
@ -443,6 +447,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
|
||||
unit, other_unit))
|
||||
}
|
||||
};
|
||||
|
||||
let mut keys = self
|
||||
.unit_dependencies
|
||||
.keys()
|
||||
@ -453,11 +458,17 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
|
||||
for unit in keys {
|
||||
for output in self.outputs(unit)?.iter() {
|
||||
if let Some(other_unit) = output_collisions.insert(output.path.clone(), unit) {
|
||||
report_collision(unit, other_unit, &output.path)?;
|
||||
if unit.mode.is_doc() {
|
||||
// See https://github.com/rust-lang/rust/issues/56169
|
||||
// and https://github.com/rust-lang/rust/issues/61378
|
||||
report_collision(unit, other_unit, &output.path, rustdoc_suggestion)?;
|
||||
} else {
|
||||
report_collision(unit, other_unit, &output.path, suggestion)?;
|
||||
}
|
||||
}
|
||||
if let Some(hardlink) = output.hardlink.as_ref() {
|
||||
if let Some(other_unit) = output_collisions.insert(hardlink.clone(), unit) {
|
||||
report_collision(unit, other_unit, hardlink)?;
|
||||
report_collision(unit, other_unit, hardlink, suggestion)?;
|
||||
}
|
||||
}
|
||||
if let Some(ref export_path) = output.export_path {
|
||||
|
@ -141,8 +141,8 @@ The lib target `foo` in package `foo2 v0.1.0 ([..]/foo/foo2)` has the same outpu
|
||||
filename as the lib target `foo` in package `foo v0.1.0 ([..]/foo)`.
|
||||
Colliding filename is: [..]/foo/target/doc/foo/index.html
|
||||
The targets should have unique names.
|
||||
Consider changing their names to be unique or compiling them separately.
|
||||
This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.
|
||||
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>.
|
||||
",
|
||||
)
|
||||
.run();
|
||||
|
Loading…
x
Reference in New Issue
Block a user