Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New semantics for `--features` flag #5353

Merged
merged 1 commit into from Apr 13, 2018

Conversation

Projects
None yet
3 participants
@matklad
Copy link
Member

matklad commented Apr 13, 2018

Historically, feature-related flags like --all-features,
--no-default-features and --features operated on the current
package. That is, cargo --package foo --feature feat would activate
feat for the package at the current working directory, and not for the
foo package. -Z package-features flag implements the more obvious
semantics for this combination of flags. This changes behavior, and that
is why we want to start with an unstable opt-in. The changes are:

  • --feature flag affects the selected package. It is an error to
    specify --feature with more than a single -p, or with -p outside
    workspace (the latter could work in theory, but would be hard to
    implement).

  • --all-features and --no-default-features affect all selected
    packages, and not the one at cwd.

  • The package in cwd is not implicitly enabled when doing feature
    selection. That is, cargo build -Z package-features -p foo could
    select less features for various packages than cargo build -p foo.

r? @alexcrichton

New semantics for `--features` flag
Historically, feature-related flags like `--all-features`,
`--no-default-features` and `--features` operated on the *current*
package. That is, `cargo --package foo --feature feat` would activate
`feat` for the package at the current working directory, and not for the
`foo` package. `-Z package-features` flag implements the more obvious
semantics for this combination of flags. This changes behavior, and that
is why we want to start with an unstable opt-in. The changes are:

* `--feature` flag affects the selected package. It is an error to
  specify `--feature` with more than a single `-p`, or with `-p` outside
  workspace (the latter could work in theory, but would be hard to
  implement).

* `--all-features` and `--no-default-features` affect all selected
  packages, and not the one at cwd.

* The package in `cwd` is not implicitly enabled when doing feature
  selection. That is, `cargo build -Z package-features -p foo` could
  select *less* features for various packages than `cargo build -p foo`.
@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Apr 13, 2018

@bors: r+

Nice!

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 13, 2018

📌 Commit 8d0b31b has been approved by alexcrichton

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 13, 2018

⌛️ Testing commit 8d0b31b with merge 008c369...

bors added a commit that referenced this pull request Apr 13, 2018

Auto merge of #5353 - matklad:features, r=alexcrichton
New semantics for `--features` flag

Historically, feature-related flags like `--all-features`,
`--no-default-features` and `--features` operated on the *current*
package. That is, `cargo --package foo --feature feat` would activate
`feat` for the package at the current working directory, and not for the
`foo` package. `-Z package-features` flag implements the more obvious
semantics for this combination of flags. This changes behavior, and that
is why we want to start with an unstable opt-in. The changes are:

* `--feature` flag affects the selected package. It is an error to
  specify `--feature` with more than a single `-p`, or with `-p` outside
  workspace (the latter could work in theory, but would be hard to
  implement).

* `--all-features` and `--no-default-features` affect all selected
  packages, and not the one at cwd.

* The package in `cwd` is not implicitly enabled when doing feature
  selection. That is, `cargo build -Z package-features -p foo` could
  select *less* features for various packages than `cargo build -p foo`.

r? @alexcrichton
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 13, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 008c369 to master...

@bors bors merged commit 8d0b31b into rust-lang:master Apr 13, 2018

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@matklad matklad deleted the matklad:features branch Apr 13, 2018

matklad added a commit to matklad/rust that referenced this pull request Apr 13, 2018

Update Cargo
This includes rust-lang/cargo#5353,
which we might want to test via opt-in in the wild

@matklad matklad referenced this pull request Apr 13, 2018

Merged

Update Cargo #49951

bors added a commit to rust-lang/rust that referenced this pull request Apr 14, 2018

Auto merge of #49951 - matklad:update-cargo, r=nrc
Update Cargo

This includes rust-lang/cargo#5353, which we  want to test via opt-in in the wild.

This'll break RLS, the fix is rust-lang/rls#822

kennytm added a commit to kennytm/rust that referenced this pull request Apr 14, 2018

Rollup merge of rust-lang#49951 - matklad:update-cargo, r=nrc
Update Cargo

This includes rust-lang/cargo#5353, which we  want to test via opt-in in the wild.

This'll break RLS, the fix is rust-lang/rls#822

alexcrichton added a commit to alexcrichton/cargo that referenced this pull request May 21, 2018

Copy `--all-features` request to all workspace members
This fixes an accidental regression introduced in rust-lang#5012 where the
`--all-features` CLI flag was only propagated to the "main crate" as opposed to
all workspace packages. This behavior has [already been deemed][pr] as
"basically not what you want", but for now it's best to avoid the regression.

Closes rust-lang#5518

[pr]: rust-lang#5353

bors added a commit that referenced this pull request May 24, 2018

Auto merge of #5556 - alexcrichton:fix, r=alexcrichton
Copy `--all-features` request to all workspace members

This fixes an accidental regression introduced in #5012 where the
`--all-features` CLI flag was only propagated to the "main crate" as opposed to
all workspace packages. This behavior has [already been deemed][pr] as
"basically not what you want", but for now it's best to avoid the regression.

Closes #5518

[pr]: #5353

bors added a commit that referenced this pull request May 24, 2018

Auto merge of #5556 - alexcrichton:fix, r=matklad
Copy `--all-features` request to all workspace members

This fixes an accidental regression introduced in #5012 where the
`--all-features` CLI flag was only propagated to the "main crate" as opposed to
all workspace packages. This behavior has [already been deemed][pr] as
"basically not what you want", but for now it's best to avoid the regression.

Closes #5518

[pr]: #5353

alexcrichton added a commit to alexcrichton/cargo that referenced this pull request May 24, 2018

Copy `--all-features` request to all workspace members
This fixes an accidental regression introduced in rust-lang#5012 where the
`--all-features` CLI flag was only propagated to the "main crate" as opposed to
all workspace packages. This behavior has [already been deemed][pr] as
"basically not what you want", but for now it's best to avoid the regression.

Closes rust-lang#5518

[pr]: rust-lang#5353
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.