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

Tracking Issue for remove-implicit-feature RFC 3491 #12826

Open
ehuss opened this issue Oct 14, 2023 · 7 comments
Open

Tracking Issue for remove-implicit-feature RFC 3491 #12826

ehuss opened this issue Oct 14, 2023 · 7 comments
Assignees
Labels
A-features Area: features — conditional compilation A-optional-dependencies Area: dependencies with optional=true C-tracking-issue Category: A tracking issue for something unstable. S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

Comments

@ehuss
Copy link
Contributor

ehuss commented Oct 14, 2023

Summary

RFC: #3491

Implementation:

Documentation: TODO
Closes: #9088, #10125

Removes the implicit feature created for optional dependencies, requiring them to be explicitly stated in the [features] table with dep:foo syntax.

Note

This has been deferred out of the 2024 edition. More updates will come in the future.

Issues

Future Extensions

No response

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

@ehuss ehuss added A-features Area: features — conditional compilation A-optional-dependencies Area: dependencies with optional=true S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review C-tracking-issue Category: A tracking issue for something unstable. A-edition-next Area: may require a breaking change over an edition labels Oct 14, 2023
@ehuss
Copy link
Contributor Author

ehuss commented Oct 14, 2023

@epage Do you want to take on implementation of this, or know someone who will? Or, if not, do you want to write mentoring instructions? I can probably do that if you don't.

@epage
Copy link
Contributor

epage commented Oct 15, 2023

@Muscraft is taking this on atm as his test case for #12235. We should pick a time to re-evaluate and, if that isn't ready in time, we pivot and hard code all of this where it is needed.

bors added a commit that referenced this issue Mar 23, 2024
feat: Add a basic linting system

This PR adds a basic linting system, the first step towards [User control over cargo warnings](#12235). To demonstrate the system, a lint for #12826 is added. It supports controlling cargo lints via the `[lints.cargo]` table. Lints can be controlled either by a group or individually.

This is meant to lay down some fundamental infrastructure for the whole linting system and is not meant to be fully featured. Over time, features will be added that will help us reach a much more solid state.
@epage
Copy link
Contributor

epage commented Apr 15, 2024

@Muscraft and I have been talking about how to implement this.

Instead of erroring in the 2024 Edition that an implicit feature was created, we are looking at treating it as an "unused optional dependency" warning. However, to truly be unused, no implicit feature should be created.

So how do we avoid that implicit feature?

Option 1: We strip unused optional dependencies before generating a Summary / before publish

This will "just work". All past and future versions of Cargo will not be able to access an implicit feature.

This would be an impediment to running other lints on unused optional dependencies because we'd be throwing out the information we'd use for linting.

This means that unused optional dependencies would not affect dependency resolution and not be included in Cargo.lock, like workspace.dependencies and unlike unused transitive dependencies from weak features (#10801).

Option 2: We include the edition in the summary

We then use edition to decide whether optional dependencies should have implicit features created.

Maybe other future work could benefit from this?

This would be quite a bit of work, requiring crates.io changes and communicating out changes required for third-party registries to support Edition 2024. But we only have 2 weeks left and coordinating across teams within that time span might be difficult.

Without a index format bump or required MSRV, old cargo will ignore Edition, allow these, and create implicit featurese

Option 3: We punt and have this warning be an error

Nuff said

Option 4: When generating the Summary / published Cargo.toml, we create foo = ["dep:foo"] features for pre-2024 Edition

The problem with this is it would require a server backfill to function properly which in a way would be a breaking change for third-party registries

bors added a commit that referenced this issue Apr 19, 2024
Unused dependencies cleanup

The implementation of #12826 was used as a demonstration for #12235, in #13621. The demonstration implementation was far from ideal and was lacking a few features. This PR makes the implementation "feature complete", and fixes known bugs with the initial implementation.
@linyihai
Copy link
Contributor

Option 1: We strip unused optional dependencies before generating a Summary / before publish

So this RFC implemetation can also fixed or mitgiate #10801 ?

@epage
Copy link
Contributor

epage commented May 27, 2024

No, that is unrelated to what was being proposed to be stripped.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 17, 2024
…-obk

Don't use implicit features in `Cargo.toml` in `compiler/`

Fixes compiler crates to stop using implicit features (rust-lang/cargo#12826) which are denied in in edition 2024.
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 18, 2024
Rollup merge of rust-lang#127769 - compiler-errors:ed-2024-dep, r=oli-obk

Don't use implicit features in `Cargo.toml` in `compiler/`

Fixes compiler crates to stop using implicit features (rust-lang/cargo#12826) which are denied in in edition 2024.
@ehuss
Copy link
Contributor Author

ehuss commented Oct 1, 2024

The cargo team has decided to drop this from the 2024 edition. There are some implementation issues, and we feel that there is just too much risk trying to resolve it at such a late date. We will update here when we have decided what to do in the future.

@epage epage added S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted. and removed S-accepted Status: Issue or feature is accepted, and has a team member available to help mentor or review A-edition-next Area: may require a breaking change over an edition labels Oct 1, 2024
@epage
Copy link
Contributor

epage commented Oct 1, 2024

#14630 removes the removal of implicit features from Edition 2024.

#14016 has a note explaining what led to this problem and some potential solutions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-features Area: features — conditional compilation A-optional-dependencies Area: dependencies with optional=true C-tracking-issue Category: A tracking issue for something unstable. S-needs-design Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Projects
Status: Big Projects, no backers
Development

No branches or pull requests

4 participants