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

Remove unused feature gates #85850

Merged
merged 3 commits into from
Jun 4, 2021
Merged

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented May 31, 2021

The first commit removes a usage of a feature gate, but I don't expect it to be controversial as the feature gate was only used to workaround a limitation of rust in the past. (closures never being Clone)

The second commit uses #[allow_internal_unstable] to avoid leaking the trusted_step feature gate usage from inside the index newtype macro. It didn't work for the min_specialization feature gate though.

The third commit removes (almost) all feature gates from the compiler that weren't used anyway.

@bjorn3 bjorn3 added C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 31, 2021
@rust-highfive
Copy link
Collaborator

r? @davidtwco

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 31, 2021
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me on commits 1 and 3, I don't understand commit 2.

@@ -65,7 +65,7 @@ impl Idx for u32 {
/// `u32::MAX`. You can also customize things like the `Debug` impl,
/// what traits are derived, and so forth via the macro.
#[macro_export]
#[allow_internal_unstable(step_trait, rustc_attrs)]
#[allow_internal_unstable(step_trait, rustc_attrs, trusted_step)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what this does? I don't know how allow_internal_unstable works.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow_internal_unstable allows a macro to use a feature gate without having to enable the feature gate in the target crate. This is for example used by libstd to allow panic!() to call an unstable function to start panicking without the user having to enable the respective feature gate.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, that seems fine in the compiler itself.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, how does that work? Aren't feature gates checked after macro expansion usually?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expansion data retrievable based on the expansion id stored in a span contains a field with all allow_internal_unstable feature gates set for the expanding macro. span.allows_unstable(feature) checks this list.

@jyn514
Copy link
Member

jyn514 commented Jun 1, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Jun 1, 2021

📌 Commit 312f964 has been approved by jyn514

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 1, 2021
@bors
Copy link
Contributor

bors commented Jun 1, 2021

⌛ Testing commit 312f964 with merge ed81246d7655b118fc693db9475aa39a91b0a0f0...

@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@bors
Copy link
Contributor

bors commented Jun 1, 2021

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 1, 2021
@bjorn3
Copy link
Member Author

bjorn3 commented Jun 1, 2021

curl: (6) Could not resolve host: ci-mirrors.rust-lang.org

Spurious network error.

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 1, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 4, 2021
Rollup of 8 pull requests

Successful merges:

 - rust-lang#85717 (Document `From` impls for cow.rs)
 - rust-lang#85850 (Remove unused feature gates)
 - rust-lang#85888 (Fix typo in internal documentation for `TrustedRandomAccess`)
 - rust-lang#85889 (Restoring the `num_def_ids` function in the CStore API )
 - rust-lang#85899 (jsondocck small cleanup)
 - rust-lang#85937 (Fix bad suggestions for code from proc_macro)
 - rust-lang#85963 (Show `::{{constructor}}` in std::any::type_name().)
 - rust-lang#85977 (Fix linkcheck script from getting out of sync.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 36f1ed6 into rust-lang:master Jun 4, 2021
@rustbot rustbot added this to the 1.54.0 milestone Jun 4, 2021
@bjorn3 bjorn3 deleted the less_feature_gates branch June 4, 2021 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants