diff options
Diffstat (limited to 'compiler/rustc_ast/src')
| -rw-r--r-- | compiler/rustc_ast/src/ast.rs | 12 | ||||
| -rw-r--r-- | compiler/rustc_ast/src/token.rs | 9 |
2 files changed, 3 insertions, 18 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 3496cfc38c8..9a9c769fd7c 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -2481,15 +2481,6 @@ pub enum Const { No, } -impl From<BoundConstness> for Const { - fn from(constness: BoundConstness) -> Self { - match constness { - BoundConstness::Maybe(span) => Self::Yes(span), - BoundConstness::Never => Self::No, - } - } -} - /// Item defaultness. /// For details see the [RFC #2532](https://github.com/rust-lang/rfcs/pull/2532). #[derive(Copy, Clone, PartialEq, Encodable, Decodable, Debug, HashStable_Generic)] @@ -2543,6 +2534,8 @@ impl BoundPolarity { pub enum BoundConstness { /// `Type: Trait` Never, + /// `Type: const Trait` + Always(Span), /// `Type: ~const Trait` Maybe(Span), } @@ -2551,6 +2544,7 @@ impl BoundConstness { pub fn as_str(self) -> &'static str { match self { Self::Never => "", + Self::Always(_) => "const", Self::Maybe(_) => "~const", } } diff --git a/compiler/rustc_ast/src/token.rs b/compiler/rustc_ast/src/token.rs index b0cd2ec9815..d62462b1ae3 100644 --- a/compiler/rustc_ast/src/token.rs +++ b/compiler/rustc_ast/src/token.rs @@ -528,15 +528,6 @@ impl Token { } } - /// Returns `true` if the token can appear at the start of a generic bound. - pub fn can_begin_bound(&self) -> bool { - self.is_path_start() - || self.is_lifetime() - || self.is_keyword(kw::For) - || self == &Question - || self == &OpenDelim(Delimiter::Parenthesis) - } - /// Returns `true` if the token can appear at the start of an item. pub fn can_begin_item(&self) -> bool { match self.kind { |
