@@ -4,16 +4,20 @@ use crate::core::{PackageId, Resolve};
4
4
use crate :: util:: errors:: CargoResult ;
5
5
use std:: collections:: { HashMap , HashSet } ;
6
6
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
8
20
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.
17
21
let mut validated: HashSet < PackageId > = HashSet :: new ( ) ;
18
22
let mut links: HashMap < String , PackageId > = HashMap :: new ( ) ;
19
23
let mut units: Vec < _ > = unit_graph. keys ( ) . collect ( ) ;
0 commit comments