Skip to content

Commit 87ee3e9

Browse files
committed
Auto merge of #12973 - dimbleby:fix-links-error-message, r=epage
fix error message for duplicate links Fixing an error message which is both misformatted and contains the wrong text. Previously it said that only one crate in the tree should use `links ='linking-crate'`; now it says that only one crate should use `links = 'linked-library'`
2 parents dd94e9d + 962d89a commit 87ee3e9

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/cargo/core/resolver/errors.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ pub(super) fn activation_error(
140140
msg.push_str("` as well:\n");
141141
msg.push_str(&describe_path_in_context(cx, p));
142142
msg.push_str("\nOnly one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. ");
143-
msg.push_str("Try to adjust your dependencies so that only one package uses the links ='");
144-
msg.push_str(&*dep.package_name());
145-
msg.push_str("' value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.");
143+
msg.push_str("Try to adjust your dependencies so that only one package uses the `links = \"");
144+
msg.push_str(link);
145+
msg.push_str("\"` value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.");
146146
}
147147
ConflictReason::MissingFeatures(features) => {
148148
msg.push_str("\n\nthe package `");

tests/testsuite/build_script.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ versions that meet the requirements `*` are: 0.5.0
10281028
10291029
the package `a-sys` links to the native library `a`, but it conflicts with a previous package which links to `a` as well:
10301030
package `foo v0.5.0 ([..])`
1031-
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the links ='a-sys' value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.
1031+
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the `links = \"a\"` value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.
10321032
10331033
failed to select a version for `a-sys` which could resolve this conflict
10341034
").run();
@@ -1148,7 +1148,7 @@ versions that meet the requirements `*` are: 0.5.0
11481148
11491149
the package `a-sys` links to the native library `a`, but it conflicts with a previous package which links to `a` as well:
11501150
package `foo v0.5.0 ([..])`
1151-
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the links ='a-sys' value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.
1151+
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the `links = \"a\"` value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.
11521152
11531153
failed to select a version for `a-sys` which could resolve this conflict
11541154
").run();
@@ -4382,7 +4382,7 @@ versions that meet the requirements `*` are: 0.5.0
43824382
43834383
the package `a` links to the native library `a`, but it conflicts with a previous package which links to `a` as well:
43844384
package `foo v0.5.0 ([..])`
4385-
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the links ='a' value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.
4385+
Only one package in the dependency graph may specify the same links value. This helps ensure that only one copy of a native library is linked in the final binary. Try to adjust your dependencies so that only one package uses the `links = \"a\"` value. For more information, see https://doc.rust-lang.org/cargo/reference/resolver.html#links.
43864386
43874387
failed to select a version for `a` which could resolve this conflict
43884388
").run();

0 commit comments

Comments
 (0)