Skip to content

Add support for making lib features internal #118123

New issue

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

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

Already on GitHub? # to your account

Merged
merged 2 commits into from
Dec 6, 2023

Conversation

RalfJung
Copy link
Member

We have the notion of an "internal" lang feature: a feature that is never intended to be stabilized, and using which can cause ICEs and other issues without that being considered a bug.

This extends that idea to lib features as well. It is an alternative to #115623: instead of using an attribute to declare lib features internal, we simply do this based on the name. Everything ending in _internals or _internal is considered internal.

Then we rename core_intrinsics to core_intrinsics_internal, which fixes #115597.

@rustbot
Copy link
Collaborator

rustbot commented Nov 21, 2023

r? @wesleywiser

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Nov 21, 2023
@rustbot
Copy link
Collaborator

rustbot commented Nov 21, 2023

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

The Miri subtree was changed

cc @rust-lang/miri

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo

@RalfJung
Copy link
Member Author

@Amanieu it looks like stdarch is using the core_intrinsics feature, so the build will fail here. What is the best way to change this feature name?

(Submodules are so painful. I hope we can transition everything to subtrees eventually...)

@rust-log-analyzer

This comment has been minimized.

@@ -207,9 +216,6 @@ declare_features! (
(internal, test_2018_feature, "1.31.0", None, Some(Edition::Edition2018)),
/// Added for testing unstable lints; perma-unstable.
(internal, test_unstable_lint, "1.60.0", None, None),
/// Allows non-`unsafe` —and thus, unsound— access to `Pin` constructions.
/// Marked `internal` since perma-unstable and unsound.
(internal, unsafe_pin_internals, "1.60.0", None, None),
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a libs feature that was added here solely to make it "incomplete" (c93968a), and then later "internal". That's not needed any more.

@RalfJung
Copy link
Member Author

Turns out it's not very hard to avoid using this feature in stdarch, so rust-lang/stdarch#1500 should let us do this transition.

@RalfJung
Copy link
Member Author

RalfJung commented Nov 21, 2023

Oh, turns out the build failure here is from compiler-builtins, not stdarch. stdarch is fine since it is not a separate crate.

EDIT: PR filed: rust-lang/compiler-builtins#557

@RalfJung
Copy link
Member Author

As suggested by @Nilstrieb, instead of trying to rename core_intrinsics I just added that to the list of internal features now. It's a hack, but it avoids the hassle of having to rename this feature, which is used all over the low-level parts of the standard library.

@rust-log-analyzer

This comment has been minimized.

@RalfJung RalfJung force-pushed the internal-lib-features branch from 9e52bec to eeabb78 Compare November 22, 2023 06:49
@rust-log-analyzer

This comment has been minimized.

@RalfJung RalfJung force-pushed the internal-lib-features branch from eeabb78 to 5b4cd1b Compare November 22, 2023 07:52
@rust-log-analyzer

This comment has been minimized.

@RalfJung RalfJung force-pushed the internal-lib-features branch from 5b4cd1b to d705627 Compare November 22, 2023 18:24
@rust-log-analyzer

This comment has been minimized.

@RalfJung RalfJung force-pushed the internal-lib-features branch from d705627 to 74834a9 Compare November 22, 2023 19:01
@rustbot
Copy link
Collaborator

rustbot commented Nov 22, 2023

Some changes occurred in src/tools/rust-analyzer

cc @rust-lang/rust-analyzer

@RalfJung
Copy link
Member Author

core_panic looks like another feature that should be covered by this. If the PR gets accepted, we should probably rename it to core_panic_internals.

@RalfJung RalfJung removed the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Dec 2, 2023
@RalfJung
Copy link
Member Author

RalfJung commented Dec 2, 2023

2 weeks without hearing from the reviewer, let me re-roll the dice.
r? compiler

@compiler-errors
Copy link
Member

Thanks @RalfJung, this is great

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 5, 2023

📌 Commit 74834a9 has been approved by compiler-errors

It is now in the queue for this repository.

@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 Dec 5, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 5, 2023
…compiler-errors

Add support for making lib features internal

We have the notion of an "internal" lang feature: a feature that is never intended to be stabilized, and using which can cause ICEs and other issues without that being considered a bug.

This extends that idea to lib features as well. It is an alternative to rust-lang#115623: instead of using an attribute to declare lib features internal, we simply do this based on the name. Everything ending in `_internals` or `_internal` is considered internal.

Then we rename `core_intrinsics` to `core_intrinsics_internal`, which fixes rust-lang#115597.
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Dec 5, 2023
…compiler-errors

Add support for making lib features internal

We have the notion of an "internal" lang feature: a feature that is never intended to be stabilized, and using which can cause ICEs and other issues without that being considered a bug.

This extends that idea to lib features as well. It is an alternative to rust-lang#115623: instead of using an attribute to declare lib features internal, we simply do this based on the name. Everything ending in `_internals` or `_internal` is considered internal.

Then we rename `core_intrinsics` to `core_intrinsics_internal`, which fixes rust-lang#115597.
compiler-errors added a commit to compiler-errors/rust that referenced this pull request Dec 5, 2023
…compiler-errors

Add support for making lib features internal

We have the notion of an "internal" lang feature: a feature that is never intended to be stabilized, and using which can cause ICEs and other issues without that being considered a bug.

This extends that idea to lib features as well. It is an alternative to rust-lang#115623: instead of using an attribute to declare lib features internal, we simply do this based on the name. Everything ending in `_internals` or `_internal` is considered internal.

Then we rename `core_intrinsics` to `core_intrinsics_internal`, which fixes rust-lang#115597.
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 5, 2023
…mpiler-errors

Rollup of 9 pull requests

Successful merges:

 - rust-lang#117793 (Update variable name to fix `unused_variables` warning)
 - rust-lang#118123 (Add support for making lib features internal)
 - rust-lang#118268 (Pretty print `Fn<(..., ...)>` trait refs with parentheses (almost) always)
 - rust-lang#118346 (Add `deeply_normalize_for_diagnostics`, use it in coherence)
 - rust-lang#118350 (Simplify Default for tuples)
 - rust-lang#118450 (Use OnceCell in cell module documentation)
 - rust-lang#118585 (Fix parser ICE when recovering `dyn`/`impl` after `for<...>`)
 - rust-lang#118587 (Cleanup error handlers some more)
 - rust-lang#118642 (bootstrap(builder.rs): Don't explicitly warn against `semicolon_in_expressions_from_macros`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 5, 2023
…mpiler-errors

Rollup of 9 pull requests

Successful merges:

 - rust-lang#117793 (Update variable name to fix `unused_variables` warning)
 - rust-lang#118123 (Add support for making lib features internal)
 - rust-lang#118268 (Pretty print `Fn<(..., ...)>` trait refs with parentheses (almost) always)
 - rust-lang#118346 (Add `deeply_normalize_for_diagnostics`, use it in coherence)
 - rust-lang#118350 (Simplify Default for tuples)
 - rust-lang#118450 (Use OnceCell in cell module documentation)
 - rust-lang#118585 (Fix parser ICE when recovering `dyn`/`impl` after `for<...>`)
 - rust-lang#118587 (Cleanup error handlers some more)
 - rust-lang#118642 (bootstrap(builder.rs): Don't explicitly warn against `semicolon_in_expressions_from_macros`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 6, 2023
…mpiler-errors

Rollup of 9 pull requests

Successful merges:

 - rust-lang#117793 (Update variable name to fix `unused_variables` warning)
 - rust-lang#118123 (Add support for making lib features internal)
 - rust-lang#118268 (Pretty print `Fn<(..., ...)>` trait refs with parentheses (almost) always)
 - rust-lang#118346 (Add `deeply_normalize_for_diagnostics`, use it in coherence)
 - rust-lang#118350 (Simplify Default for tuples)
 - rust-lang#118450 (Use OnceCell in cell module documentation)
 - rust-lang#118585 (Fix parser ICE when recovering `dyn`/`impl` after `for<...>`)
 - rust-lang#118587 (Cleanup error handlers some more)
 - rust-lang#118642 (bootstrap(builder.rs): Don't explicitly warn against `semicolon_in_expressions_from_macros`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 6, 2023
…mpiler-errors

Rollup of 9 pull requests

Successful merges:

 - rust-lang#117793 (Update variable name to fix `unused_variables` warning)
 - rust-lang#118123 (Add support for making lib features internal)
 - rust-lang#118268 (Pretty print `Fn<(..., ...)>` trait refs with parentheses (almost) always)
 - rust-lang#118346 (Add `deeply_normalize_for_diagnostics`, use it in coherence)
 - rust-lang#118350 (Simplify Default for tuples)
 - rust-lang#118450 (Use OnceCell in cell module documentation)
 - rust-lang#118585 (Fix parser ICE when recovering `dyn`/`impl` after `for<...>`)
 - rust-lang#118587 (Cleanup error handlers some more)
 - rust-lang#118642 (bootstrap(builder.rs): Don't explicitly warn against `semicolon_in_expressions_from_macros`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 19bf749 into rust-lang:master Dec 6, 2023
@rustbot rustbot added this to the 1.76.0 milestone Dec 6, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 6, 2023
Rollup merge of rust-lang#118123 - RalfJung:internal-lib-features, r=compiler-errors

Add support for making lib features internal

We have the notion of an "internal" lang feature: a feature that is never intended to be stabilized, and using which can cause ICEs and other issues without that being considered a bug.

This extends that idea to lib features as well. It is an alternative to rust-lang#115623: instead of using an attribute to declare lib features internal, we simply do this based on the name. Everything ending in `_internals` or `_internal` is considered internal.

Then we rename `core_intrinsics` to `core_intrinsics_internal`, which fixes rust-lang#115597.
@RalfJung RalfJung deleted the internal-lib-features branch December 6, 2023 21:24
tshepang added a commit to ferrocene/ferrocene that referenced this pull request Dec 7, 2023
tshepang added a commit to ferrocene/ferrocene that referenced this pull request Dec 7, 2023
tshepang added a commit to ferrocene/ferrocene that referenced this pull request Dec 8, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 6, 2024
…8472

merge core_panic feature into panic_internals

I don't know why those are two separate features, but it does not seem intentional. This merge is useful because with rust-lang#118123, panic_internals is recognized as an internal feature, but core_panic is not -- but core_panic definitely should be internal.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 6, 2024
Rollup merge of rust-lang#118781 - RalfJung:core-panic-feature, r=the8472

merge core_panic feature into panic_internals

I don't know why those are two separate features, but it does not seem intentional. This merge is useful because with rust-lang#118123, panic_internals is recognized as an internal feature, but core_panic is not -- but core_panic definitely should be internal.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

core_intrinsics should be marked as an internal feature
6 participants