@@ -9,13 +9,15 @@ use crate::util::hex::short_hash;
99use crate :: util:: interning:: InternedString ;
1010use crate :: util:: GlobalContext ;
1111use std:: cell:: RefCell ;
12- use std:: collections:: HashSet ;
12+ use std:: collections:: { BTreeMap , HashSet } ;
1313use std:: fmt;
1414use std:: hash:: { Hash , Hasher } ;
1515use std:: ops:: Deref ;
1616use std:: rc:: Rc ;
1717use std:: sync:: Arc ;
1818
19+ use super :: BuildOutput ;
20+
1921/// All information needed to define a unit.
2022///
2123/// A unit is an object that has enough information so that cargo knows how to build it.
@@ -82,6 +84,12 @@ pub struct UnitInner {
8284 /// [`BuildContext::extra_args_for`]: crate::core::compiler::build_context::BuildContext::extra_args_for
8385 /// [`TargetInfo.rustdocflags`]: crate::core::compiler::build_context::TargetInfo::rustdocflags
8486 pub rustdocflags : Arc < [ String ] > ,
87+ /// Build script override for the given library name.
88+ ///
89+ /// Any package with a `links` value for the given library name will skip
90+ /// running its build script and instead use the given output from the
91+ /// config file.
92+ pub links_overrides : Rc < BTreeMap < String , BuildOutput > > ,
8593 // if `true`, the dependency is an artifact dependency, requiring special handling when
8694 // calculating output directories, linkage and environment variables provided to builds.
8795 pub artifact : IsArtifact ,
@@ -176,6 +184,7 @@ impl fmt::Debug for Unit {
176184 . field ( "features" , & self . features )
177185 . field ( "rustflags" , & self . rustflags )
178186 . field ( "rustdocflags" , & self . rustdocflags )
187+ . field ( "links_overrides" , & self . links_overrides )
179188 . field ( "artifact" , & self . artifact . is_true ( ) )
180189 . field (
181190 "artifact_target_for_features" ,
@@ -225,6 +234,7 @@ impl UnitInterner {
225234 features : Vec < InternedString > ,
226235 rustflags : Arc < [ String ] > ,
227236 rustdocflags : Arc < [ String ] > ,
237+ links_overrides : Rc < BTreeMap < String , BuildOutput > > ,
228238 is_std : bool ,
229239 dep_hash : u64 ,
230240 artifact : IsArtifact ,
@@ -260,6 +270,7 @@ impl UnitInterner {
260270 features,
261271 rustflags,
262272 rustdocflags,
273+ links_overrides,
263274 is_std,
264275 dep_hash,
265276 artifact,
0 commit comments