summaryrefslogtreecommitdiffstats
path: root/vendor/proc-macro2/src/parse.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/proc-macro2/src/parse.rs')
-rw-r--r--vendor/proc-macro2/src/parse.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/vendor/proc-macro2/src/parse.rs b/vendor/proc-macro2/src/parse.rs
index 1c9974cfa..307e06508 100644
--- a/vendor/proc-macro2/src/parse.rs
+++ b/vendor/proc-macro2/src/parse.rs
@@ -14,7 +14,7 @@ pub(crate) struct Cursor<'a> {
}
impl<'a> Cursor<'a> {
- fn advance(&self, bytes: usize) -> Cursor<'a> {
+ pub fn advance(&self, bytes: usize) -> Cursor<'a> {
let (_front, rest) = self.rest.split_at(bytes);
Cursor {
rest,
@@ -23,7 +23,7 @@ impl<'a> Cursor<'a> {
}
}
- fn starts_with(&self, s: &str) -> bool {
+ pub fn starts_with(&self, s: &str) -> bool {
self.rest.starts_with(s)
}
@@ -116,9 +116,9 @@ fn block_comment(input: Cursor) -> PResult<&str> {
return Err(Reject);
}
- let mut depth = 0;
+ let mut depth = 0usize;
let bytes = input.as_bytes();
- let mut i = 0;
+ let mut i = 0usize;
let upper = bytes.len() - 1;
while i < upper {
@@ -283,8 +283,9 @@ fn ident_any(input: Cursor) -> PResult<crate::Ident> {
return Ok((rest, ident));
}
- if sym == "_" {
- return Err(Reject);
+ match sym {
+ "_" | "super" | "self" | "Self" | "crate" => return Err(Reject),
+ _ => {}
}
let ident = crate::Ident::_new_raw(sym, crate::Span::call_site());