Skip to content

Use Cargo's "namespace features" feature#4293

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:namespace-features
Jun 21, 2022
Merged

Use Cargo's "namespace features" feature#4293
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:namespace-features

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

Cargo recently added the ability to have an optional dependency without
implicitly introducing a new named feature on a crate. This is triggered
with some new directives in the [features] section, specifically:

  • The dep:foo syntax means that foo is activated but no implicit
    feature should be added named foo.

  • Additionally foo?/bar means that the bar feature of foo is only
    activated if foo is otherwise activated elsewhere, for example a
    conditional activation.

These two features can help avoid extra feature names showing up that we
don't want (e.g. currently the wasmtime crate has a rayon feature)
and additionally can help avoid runtime dependencies in niche cases for
us (e.g. activating all-arch but disabling cranelift would
previously pull-in cranelift but no longer will).

Cargo recently added the ability to have an optional dependency without
implicitly introducing a new named feature on a crate. This is triggered
with some new directives in the `[features]` section, specifically:

* The `dep:foo` syntax means that `foo` is activated but no implicit
  feature should be added named `foo`.

* Additionally `foo?/bar` means that the `bar` feature of `foo` is only
  activated if `foo` is otherwise activated elsewhere, for example a
  conditional activation.

These two features can help avoid extra feature names showing up that we
don't want (e.g. currently the `wasmtime` crate has a `rayon` feature)
and additionally can help avoid runtime dependencies in niche cases for
us (e.g. activating `all-arch` but disabling `cranelift` would
previously pull-in cranelift but no longer will).
@alexcrichton alexcrichton marked this pull request as ready for review June 21, 2022 19:05
@github-actions github-actions Bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Jun 21, 2022
@github-actions
Copy link
Copy Markdown

Subscribe to Label Action

cc @peterhuene

Details This issue or pull request has been labeled: "wasmtime:api"

Thus the following users have been cc'd because of the following labels:

  • peterhuene: wasmtime:api

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

@alexcrichton alexcrichton merged commit 2f9d96c into bytecodealliance:main Jun 21, 2022
@alexcrichton alexcrichton deleted the namespace-features branch June 21, 2022 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:api Related to the API of the `wasmtime` crate itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants