-
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
base: master
Are you sure you want to change the base?
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
Remove
#[const_trait]since we now haveconst trait. Update all structured diagnostics that still suggested the attribute.r? @rust-lang/project-const-traits