Rollup merge of #139858 - oli-obk:new-const-traits-syntax, r=fee1-dead
New const traits syntax This PR only affects the AST and doesn't actually change anything semantically. All occurrences of `~const` outside of libcore have been replaced by `[const]`. Within libcore we have to wait for rustfmt to be bumped in the bootstrap compiler. This will happen "automatically" (when rustfmt is run) during the bootstrap bump, as rustfmt converts `~const` into `[const]`. After this we can remove the `~const` support from the parser Caveat discovered during impl: there is no legacy bare trait object recovery for `[const] Trait` as that snippet in type position goes down the slice /array parsing code and will error r? ``@fee1-dead`` cc ``@nikomatsakis`` ``@traviscross`` ``@compiler-errors``
This commit is contained in:
@@ -323,7 +323,7 @@ impl ParenthesizedArgs {
|
||||
|
||||
pub use crate::node_id::{CRATE_NODE_ID, DUMMY_NODE_ID, NodeId};
|
||||
|
||||
/// Modifiers on a trait bound like `~const`, `?` and `!`.
|
||||
/// Modifiers on a trait bound like `[const]`, `?` and `!`.
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug)]
|
||||
pub struct TraitBoundModifiers {
|
||||
pub constness: BoundConstness,
|
||||
@@ -3115,7 +3115,7 @@ pub enum BoundConstness {
|
||||
Never,
|
||||
/// `Type: const Trait`
|
||||
Always(Span),
|
||||
/// `Type: ~const Trait`
|
||||
/// `Type: [const] Trait`
|
||||
Maybe(Span),
|
||||
}
|
||||
|
||||
@@ -3124,7 +3124,7 @@ impl BoundConstness {
|
||||
match self {
|
||||
Self::Never => "",
|
||||
Self::Always(_) => "const",
|
||||
Self::Maybe(_) => "~const",
|
||||
Self::Maybe(_) => "[const]",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user