-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add the #[derive_const]
attribute
#102049
Conversation
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
src/test/ui/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.rs
Show resolved
Hide resolved
Do the Also can this be used in std, since it doesn't have feature gates? |
#[derive_const]
attribute#[derive_const]
attribute
@bors r+ |
…oli-obk Add the `#[derive_const]` attribute Closes rust-lang#102371. This is a minimal patchset for the attribute to work. There are no restrictions on what traits this attribute applies to. r? ``@oli-obk``
…oli-obk Add the `#[derive_const]` attribute Closes rust-lang#102371. This is a minimal patchset for the attribute to work. There are no restrictions on what traits this attribute applies to. r? ```@oli-obk```
…oli-obk Add the `#[derive_const]` attribute Closes rust-lang#102371. This is a minimal patchset for the attribute to work. There are no restrictions on what traits this attribute applies to. r? ````@oli-obk````
Rollup of 7 pull requests Successful merges: - rust-lang#102049 (Add the `#[derive_const]` attribute) - rust-lang#103970 (Unhide unknown spans) - rust-lang#104206 (Remove `save_and_restore_in_snapshot_flag`, use `ObligationCtxt` more) - rust-lang#104214 (Emit error in `collecting_trait_impl_trait_tys` on mismatched signatures) - rust-lang#104267 (rustdoc: use checkbox instead of switch for settings toggles) - rust-lang#104302 (Update cargo) - rust-lang#104303 (UI tests can be assigned to T-compiler) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
I wonder if there's a plan for const traits to be derived by regular derives, if eligible. Having to have both a regular derive and derive_const is quite noisy. There's already a bit of precendence for smarter derives with generics, where the derive outputs a I know this could be some kind of a semver footgun for libraries, but those could fall back to manual impls, if they really want to be sure not to overpromise. |
Closes #102371. This is a minimal patchset for the attribute to work. There are no restrictions on what traits this attribute applies to.
r? @oli-obk