Skip to content

Commit 4c507b4

Browse files
committed
doc: enhancement of compiler::links
1 parent 4262636 commit 4c507b4

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/cargo/core/compiler/links.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@ use crate::core::{PackageId, Resolve};
44
use crate::util::errors::CargoResult;
55
use std::collections::{HashMap, HashSet};
66

7-
/// Validate `links` field does not conflict between packages.
7+
/// Validates [`package.links`] field in the manifest file does not conflict
8+
/// between packages.
9+
///
10+
/// NOTE: This is the *old* links validator. Links are usually validated in the
11+
/// resolver. However, the `links` field was added to the index in early 2018
12+
/// (see [rust-lang/cargo#4978]). However, `links` has been around since 2014,
13+
/// so there are still many crates in the index that don't have `links`
14+
/// properly set in the index (over 600 at the time of this writing in 2019).
15+
/// This can probably be removed at some point in the future, though it might
16+
/// be worth considering fixing the index.
17+
///
18+
/// [rust-lang/cargo#4978]: https://github.com/rust-lang/cargo/pull/4978
19+
/// [`package.links`]: https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#the-links-manifest-key
820
pub fn validate_links(resolve: &Resolve, unit_graph: &UnitGraph) -> CargoResult<()> {
9-
// NOTE: This is the *old* links validator. Links are usually validated in
10-
// the resolver. However, the `links` field was added to the index in
11-
// early 2018 (see https://github.com/rust-lang/cargo/pull/4978). However,
12-
// `links` has been around since 2014, so there are still many crates in
13-
// the index that don't have `links` properly set in the index (over 600
14-
// at the time of this writing in 2019). This can probably be removed at
15-
// some point in the future, though it might be worth considering fixing
16-
// the index.
1721
let mut validated: HashSet<PackageId> = HashSet::new();
1822
let mut links: HashMap<String, PackageId> = HashMap::new();
1923
let mut units: Vec<_> = unit_graph.keys().collect();

0 commit comments

Comments
 (0)