summaryrefslogtreecommitdiffstats
path: root/vendor/proc-macro2/src/fallback.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/fallback.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/fallback.rs')
-rw-r--r--vendor/proc-macro2/src/fallback.rs28
1 files changed, 27 insertions, 1 deletions
diff --git a/vendor/proc-macro2/src/fallback.rs b/vendor/proc-macro2/src/fallback.rs
index 378ef7e94..fe4f248d3 100644
--- a/vendor/proc-macro2/src/fallback.rs
+++ b/vendor/proc-macro2/src/fallback.rs
@@ -182,7 +182,13 @@ impl FromStr for TokenStream {
fn from_str(src: &str) -> Result<TokenStream, LexError> {
// Create a dummy file & add it to the source map
- let cursor = get_cursor(src);
+ let mut cursor = get_cursor(src);
+
+ // Strip a byte order mark if present
+ const BYTE_ORDER_MARK: &str = "\u{feff}";
+ if cursor.starts_with(BYTE_ORDER_MARK) {
+ cursor = cursor.advance(BYTE_ORDER_MARK.len());
+ }
parse::token_stream(cursor)
}
@@ -512,6 +518,26 @@ impl Span {
})
}
+ #[cfg(procmacro2_semver_exempt)]
+ pub fn before(&self) -> Span {
+ Span {
+ #[cfg(span_locations)]
+ lo: self.lo,
+ #[cfg(span_locations)]
+ hi: self.lo,
+ }
+ }
+
+ #[cfg(procmacro2_semver_exempt)]
+ pub fn after(&self) -> Span {
+ Span {
+ #[cfg(span_locations)]
+ lo: self.hi,
+ #[cfg(span_locations)]
+ hi: self.hi,
+ }
+ }
+
#[cfg(not(span_locations))]
pub fn join(&self, _other: Span) -> Option<Span> {
Some(Span {})