summary refs log tree commit diff
path: root/src/libsyntax/parse/token.rs
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2017-10-10 17:33:19 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2017-10-14 12:51:13 +0300
commite6115af4bd5f07024e0b73139e1dbcd68c96d9f7 (patch)
treecaead936dd84ba0d4492222d3c3bd6da121dffd3 /src/libsyntax/parse/token.rs
parent3037965b5bb762b6ed0dc860aefe01b664943ce8 (diff)
downloadrust-e6115af4bd5f07024e0b73139e1dbcd68c96d9f7.tar.gz
rust-e6115af4bd5f07024e0b73139e1dbcd68c96d9f7.zip
Implement `dyn Trait` syntax
Diffstat (limited to 'src/libsyntax/parse/token.rs')
-rw-r--r--src/libsyntax/parse/token.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 4888654fac9..20db87cfc82 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -258,6 +258,12 @@ 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(keywords::For) ||
+        self == &Question || self == &OpenDelim(Paren)
+    }
+
     /// Returns `true` if the token is any literal
     pub fn is_lit(&self) -> bool {
         match *self {