-
Notifications
You must be signed in to change notification settings - Fork 14k
Remove #[const_trait]
#148683
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 #[const_trait]
#148683
Conversation
|
Some changes occurred to the CTFE machinery Some changes occurred in compiler/rustc_attr_parsing Some changes occurred in compiler/rustc_hir/src/attrs Some changes occurred to constck cc @fee1-dead Some changes occurred in compiler/rustc_passes/src/check_attr.rs |
| //[nyy,nyn,nny,nnn]~^ ERROR: const trait impls are experimental | ||
| #[cfg(any(yny, ynn, nny, nnn))] trait Foo { fn a(&self); } | ||
|
|
||
| #[cfg_attr(any(yyy, yny, nyy, nyn), const_trait)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nyn was incorrect in that it didn't follow the pattern that's explicitly established at the top of the file (where 0 |-> const_trait_impl enabled?, 1 |-> Foo const?, 2 |-> Bar const?) since the last n incorrectly claimed that under this revision Bar was not const despite literally enabling #[const_trait] when active.
Replaced with nny, hence some of the error annotation changes.
| && let &TraitOrTraitImpl::Trait { vis, constness: ast::Const::No } = parent | ||
| { | ||
| Some(span.shrink_to_lo()) | ||
| Some(map.span_extend_while_whitespace(vis).shrink_to_hi()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pattern occurs in three more places (tho you can't really abstract over it). It yields a syntactically correct suggestion with any(*) combination of trait modifiers/qualifiers present and can deal with inherited visibility, pub , pub(…) and pub(…) (i.e., no trailing space).
(*): It does not account for specialization's default which theoretically comes before const (like visibility), however that's actually syntactically invalid but the parser does recover from it. Still, it's really not worth accounting for.
This comment has been minimized.
This comment has been minimized.
1009c65 to
c262920
Compare
|
Thanks! @bors r+ |
…-dead Remove `#[const_trait]` Remove `#[const_trait]` since we now have `const trait`. Update all structured diagnostics that still suggested the attribute. r? `@rust-lang/project-const-traits`
Rollup of 10 pull requests Successful merges: - #148608 (Add test for --test-builder success path) - #148683 (Remove `#[const_trait]`) - #148687 (std: use a non-poisoning `RwLock` for the panic hook) - #148709 (fix: disable self-contained linker when bootstrap-override-lld is set) - #148716 (mgca: Finish implementation of `#[type_const]`) - #148722 (Add Crystal Durham to .mailmap) - #148723 (bootstrap: Render doctest timing reports as text, not JSON) - #148724 (tidy: Don't bypass stderr output capture in unit tests) - #148734 (miri subtree update) - #148736 (Fix typo in unstable-book link) r? `@ghost` `@rustbot` modify labels: rollup
…-dead Remove `#[const_trait]` Remove `#[const_trait]` since we now have `const trait`. Update all structured diagnostics that still suggested the attribute. r? ``@rust-lang/project-const-traits``
Rollup of 10 pull requests Successful merges: - #148683 (Remove `#[const_trait]`) - #148687 (std: use a non-poisoning `RwLock` for the panic hook) - #148709 (fix: disable self-contained linker when bootstrap-override-lld is set) - #148716 (mgca: Finish implementation of `#[type_const]`) - #148722 (Add Crystal Durham to .mailmap) - #148723 (bootstrap: Render doctest timing reports as text, not JSON) - #148724 (tidy: Don't bypass stderr output capture in unit tests) - #148734 (miri subtree update) - #148736 (Fix typo in unstable-book link) - #148744 (Add myself(chenyukang) to the review rotation) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #148683 - fmease:rm-const_trait-attr, r=fee1-dead Remove `#[const_trait]` Remove `#[const_trait]` since we now have `const trait`. Update all structured diagnostics that still suggested the attribute. r? ```@rust-lang/project-const-traits```
Remove
#[const_trait]since we now haveconst trait. Update all structured diagnostics that still suggested the attribute.r? @rust-lang/project-const-traits