summaryrefslogtreecommitdiffstats
path: root/vendor/proc-macro2/src/parse.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:11:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:12:43 +0000
commitcf94bdc0742c13e2a0cac864c478b8626b266e1b (patch)
tree044670aa50cc5e2b4229aa0b6b3df6676730c0a6 /vendor/proc-macro2/src/parse.rs
parentAdding debian version 1.65.0+dfsg1-2. (diff)
downloadrustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.tar.xz
rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.zip
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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());