@@ -412,9 +412,13 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
412
412
"Consider changing their names to be unique or compiling them separately.\n \
413
413
This may become a hard error in the future; see \
414
414
<https://github.com/rust-lang/cargo/issues/6313>.";
415
+ let rustdoc_suggestion =
416
+ "This is a known bug where multiple crates with the same name use\n \
417
+ the same path; see <https://github.com/rust-lang/cargo/issues/6313>.";
415
418
let report_collision = |unit : & Unit < ' _ > ,
416
419
other_unit : & Unit < ' _ > ,
417
- path : & PathBuf |
420
+ path : & PathBuf ,
421
+ suggestion : & str |
418
422
-> CargoResult < ( ) > {
419
423
if unit. target . name ( ) == other_unit. target . name ( ) {
420
424
self . bcx . config . shell ( ) . warn ( format ! (
@@ -443,6 +447,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
443
447
unit, other_unit) )
444
448
}
445
449
} ;
450
+
446
451
let mut keys = self
447
452
. unit_dependencies
448
453
. keys ( )
@@ -453,11 +458,17 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
453
458
for unit in keys {
454
459
for output in self . outputs ( unit) ?. iter ( ) {
455
460
if let Some ( other_unit) = output_collisions. insert ( output. path . clone ( ) , unit) {
456
- report_collision ( unit, other_unit, & output. path ) ?;
461
+ if unit. mode . is_doc ( ) {
462
+ // See https://github.com/rust-lang/rust/issues/56169
463
+ // and https://github.com/rust-lang/rust/issues/61378
464
+ report_collision ( unit, other_unit, & output. path , rustdoc_suggestion) ?;
465
+ } else {
466
+ report_collision ( unit, other_unit, & output. path , suggestion) ?;
467
+ }
457
468
}
458
469
if let Some ( hardlink) = output. hardlink . as_ref ( ) {
459
470
if let Some ( other_unit) = output_collisions. insert ( hardlink. clone ( ) , unit) {
460
- report_collision ( unit, other_unit, hardlink) ?;
471
+ report_collision ( unit, other_unit, hardlink, suggestion ) ?;
461
472
}
462
473
}
463
474
if let Some ( ref export_path) = output. export_path {
0 commit comments