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

Transition out implicit features for optional dependencies #12173

Closed
epage opened this issue May 24, 2023 · 4 comments
Closed

Transition out implicit features for optional dependencies #12173

epage opened this issue May 24, 2023 · 4 comments
Labels
A-edition-next Area: may require a breaking change over an edition A-features Area: features — conditional compilation C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-team-input Status: Needs input from team on whether/how to proceed.

Comments

@epage
Copy link
Contributor

epage commented May 24, 2023

Problem

Today cargo will implicitly create a feature for optional dependencies unless the dependency is referenced in a feature as dep:<dep_name>.

Downsides

Proposed Solution

We should stop implicitly creating features in a new Edition

Optional dependencies without a dep: reference can be either

  • A hard error
  • Allowed assuming people will then want to use it via the future #[cfg(accessible)]
    • The downside is users might assume a feature would exist (at first) and things not work as expected
    • We could start with an error and move away from it
  • Create private features (private/hidden features #10882, see also Allow optional dev-dependencies #1596)

cargo add foo --optional can implicitly create a feature with the dependency's name, if a dep:foo doesn't already exist (#11010).

Notes

No response

@epage epage added A-features Area: features — conditional compilation C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` A-edition-next Area: may require a breaking change over an edition S-triage Status: This issue is waiting on initial triage. labels May 24, 2023
@epage
Copy link
Contributor Author

epage commented May 24, 2023

See also #9088

@epage
Copy link
Contributor Author

epage commented May 24, 2023

The main hurdle for transitioning is that #12130 was just barely merged though there is the workaround of "dep:foo", "foo?/feat" which would be the standard way of doing it with #10556.

@weihanglo weihanglo added S-needs-team-input Status: Needs input from team on whether/how to proceed. and removed S-triage Status: This issue is waiting on initial triage. labels Jun 2, 2023
@ehuss
Copy link
Contributor

ehuss commented Oct 14, 2023

@epage Do you want to keep this issue open?

@epage
Copy link
Contributor Author

epage commented Oct 15, 2023

If this were about a specific use case then I might want to keep it open but since its effectively "lets make an RFC", lets close it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-next Area: may require a breaking change over an edition A-features Area: features — conditional compilation C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-team-input Status: Needs input from team on whether/how to proceed.
Projects
Archived in project
Development

No branches or pull requests

3 participants