rustdoc.arg("--cfg").arg(&format!("feature=\"{}\"", feat));
}
+ let manifest = unit.pkg.manifest();
+
+ if manifest.features().is_enabled(Feature::edition()) {
+ rustdoc.arg("-Zunstable-options");
+ rustdoc.arg(format!("--edition={}", &manifest.edition()));
+ }
+
if let Some(ref args) = unit.profile.rustdoc_args {
rustdoc.args(args);
}
use std::fs::{self, File};
use std::io::Read;
-use cargotest::rustc_host;
+use cargotest::{rustc_host, ChannelChanger};
use cargotest::support::{execs, project, path2url};
use cargotest::support::registry::Package;
use hamcrest::{assert_that, existing_dir, existing_file, is_not};
.with_stderr_contains(" bar"),
);
}
+
+#[test]
+fn doc_edition() {
+ if !cargotest::is_nightly() {
+ // Stable rustdoc won't have the edition option. Remove this once it
+ // is stabilized.
+ return;
+ }
+ let p = project("foo")
+ .file(
+ "Cargo.toml",
+ r#"
+ cargo-features = ["edition"]
+ [package]
+ name = "foo"
+ version = "0.0.1"
+ authors = []
+ rust = "2018"
+ "#,
+ )
+ .file("src/lib.rs", "")
+ .build();
+
+ assert_that(
+ p.cargo("doc").arg("-v").masquerade_as_nightly_cargo(),
+ execs()
+ .with_status(0)
+ .with_stderr_contains("[RUNNING] `rustdoc [..]-Zunstable-options --edition=2018[..]"),
+ );
+}