diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index 5ed9c7f25..7f848fd70 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -43,12 +43,6 @@ pub struct PublishOpts<'cfg> { pub fn publish(ws: &Workspace, opts: &PublishOpts) -> CargoResult<()> { let pkg = ws.current()?; - // Allow publishing if a registry has been provided, or if there are no nightly - // features enabled. - if opts.registry.is_none() && !pkg.manifest().features().activated().is_empty() { - bail!("cannot publish crates which activate nightly-only cargo features to crates.io") - } - if let Some(ref allowed_registries) = *pkg.publish() { if !match opts.registry { Some(ref registry) => allowed_registries.contains(registry), diff --git a/tests/testsuite/cargo_features.rs b/tests/testsuite/cargo_features.rs index 82de88676..0e95257f3 100644 --- a/tests/testsuite/cargo_features.rs +++ b/tests/testsuite/cargo_features.rs @@ -1,5 +1,5 @@ use cargotest::ChannelChanger; -use cargotest::support::{execs, project}; +use cargotest::support::{execs, project, publish}; use hamcrest::assert_that; #[test] @@ -303,7 +303,9 @@ fn z_flags_rejected() { } #[test] -fn publish_rejected() { +fn publish_allowed() { + publish::setup(); + let p = project("foo") .file( "Cargo.toml", @@ -319,9 +321,10 @@ fn publish_rejected() { .file("src/lib.rs", "") .build(); assert_that( - p.cargo("publish").masquerade_as_nightly_cargo(), - execs().with_status(101).with_stderr( - "error: cannot publish crates which activate nightly-only cargo features to crates.io", - ), + p.cargo("publish") + .arg("--index") + .arg(publish::registry().to_string()) + .masquerade_as_nightly_cargo(), + execs().with_status(0), ); }