let pkg = ws.current()?;
let config = ws.config();
- // Allow packaging 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 package or publish crates which activate nightly-only \
- cargo features")
- }
let mut src = PathSource::new(pkg.root(),
pkg.package_id().source_id(),
config);
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),
"#)
.file("src/lib.rs", "")
.build();
- assert_that(p.cargo("package")
+ assert_that(p.cargo("publish")
.masquerade_as_nightly_cargo(),
execs().with_status(101)
.with_stderr("\
-error: cannot package or publish crates which activate nightly-only cargo features
+error: cannot publish crates which activate nightly-only cargo features to crates.io
"));
}
.build();
assert_that(p.cargo("publish").masquerade_as_nightly_cargo()
- .arg("--index").arg(publish::registry().to_string()),
+ .arg("--registry").arg("alternative")
+ .arg("-Zunstable-options"),
execs().with_status(101).with_stderr("\
[ERROR] some crates cannot be published.
`foo` is marked as unpublishable