diff --git a/src/cargo/core/manifest.rs b/src/cargo/core/manifest.rs index a988460f676..f2c5c0d2843 100644 --- a/src/cargo/core/manifest.rs +++ b/src/cargo/core/manifest.rs @@ -21,6 +21,7 @@ pub struct Manifest { profiles: Profiles, publish: bool, replace: Vec<(PackageIdSpec, Dependency)>, + css_extension: Option, } /// General metadata about a package which is just blindly uploaded to the @@ -166,7 +167,8 @@ impl Manifest { metadata: ManifestMetadata, profiles: Profiles, publish: bool, - replace: Vec<(PackageIdSpec, Dependency)>) -> Manifest { + replace: Vec<(PackageIdSpec, Dependency)>, + css_extension: Option) -> Manifest { Manifest { summary: summary, targets: targets, @@ -178,6 +180,7 @@ impl Manifest { profiles: profiles, publish: publish, replace: replace, + css_extension: css_extension, } } @@ -197,6 +200,9 @@ impl Manifest { pub fn links(&self) -> Option<&str> { self.links.as_ref().map(|s| &s[..]) } + pub fn css_extension(&self) -> Option<&str> { + self.css_extension.as_ref().map(|s| &s[..]) + } pub fn add_warning(&mut self, s: String) { self.warnings.push(s) diff --git a/src/cargo/ops/cargo_rustc/mod.rs b/src/cargo/ops/cargo_rustc/mod.rs index ab1ce343e33..65dd5dad60d 100644 --- a/src/cargo/ops/cargo_rustc/mod.rs +++ b/src/cargo/ops/cargo_rustc/mod.rs @@ -379,6 +379,12 @@ fn rustdoc(cx: &mut Context, unit: &Unit) -> CargoResult { rustdoc.arg("--target").arg(target); } + if let Some(css_extension) = unit.pkg.manifest().css_extension() { + // We need to activate nightly option to make this option available + rustdoc.arg("-Z").arg("unstable-options"); + rustdoc.arg("--extend-css").arg(css_extension); + } + let doc_dir = cx.out_dir(unit); // Create the documentation directory ahead of time as rustdoc currently has diff --git a/src/cargo/util/toml.rs b/src/cargo/util/toml.rs index 5e0d3868e39..27f9a2e58ba 100644 --- a/src/cargo/util/toml.rs +++ b/src/cargo/util/toml.rs @@ -250,6 +250,7 @@ pub struct TomlProject { exclude: Option>, include: Option>, publish: Option, + css_extension: Option, // package metadata description: Option, @@ -584,6 +585,7 @@ impl TomlManifest { let exclude = project.exclude.clone().unwrap_or(Vec::new()); let include = project.include.clone().unwrap_or(Vec::new()); + let css_extension = project.css_extension.clone(); let summary = try!(Summary::new(pkgid, deps, self.features.clone() @@ -609,7 +611,8 @@ impl TomlManifest { metadata, profiles, publish, - replace); + replace, + css_extension); if project.license_file.is_some() && project.license.is_some() { manifest.add_warning(format!("only one of `license` or \ `license-file` is necessary"));