@@ -71,6 +71,17 @@ pub struct UnitInner {
7171 /// [`BuildContext::extra_args_for`]: crate::core::compiler::build_context::BuildContext::extra_args_for
7272 /// [`TargetInfo.rustflags`]: crate::core::compiler::build_context::TargetInfo::rustflags
7373 pub rustflags : Arc < [ String ] > ,
74+ /// Extra compiler flags to pass to `rustdoc` for a given unit.
75+ ///
76+ /// Although it depends on the caller, in the current Cargo implementation,
77+ /// these flags take precedence over those from [`BuildContext::extra_args_for`].
78+ ///
79+ /// As of now, these flags come from environment variables and configurations.
80+ /// See [`TargetInfo.rustdocflags`] for more on how Cargo collects them.
81+ ///
82+ /// [`BuildContext::extra_args_for`]: crate::core::compiler::build_context::BuildContext::extra_args_for
83+ /// [`TargetInfo.rustdocflags`]: crate::core::compiler::build_context::TargetInfo::rustdocflags
84+ pub rustdocflags : Arc < [ String ] > ,
7485 // if `true`, the dependency is an artifact dependency, requiring special handling when
7586 // calculating output directories, linkage and environment variables provided to builds.
7687 pub artifact : IsArtifact ,
@@ -212,6 +223,7 @@ impl UnitInterner {
212223 mode : CompileMode ,
213224 features : Vec < InternedString > ,
214225 rustflags : Arc < [ String ] > ,
226+ rustdocflags : Arc < [ String ] > ,
215227 is_std : bool ,
216228 dep_hash : u64 ,
217229 artifact : IsArtifact ,
@@ -246,6 +258,7 @@ impl UnitInterner {
246258 mode,
247259 features,
248260 rustflags,
261+ rustdocflags,
249262 is_std,
250263 dep_hash,
251264 artifact,
0 commit comments