summaryrefslogtreecommitdiffstats
path: root/vendor/proc-macro2/src/wrapper.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:11:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:11:28 +0000
commit94a0819fe3a0d679c3042a77bfe6a2afc505daea (patch)
tree2b827afe6a05f3538db3f7803a88c4587fe85648 /vendor/proc-macro2/src/wrapper.rs
parentAdding upstream version 1.64.0+dfsg1. (diff)
downloadrustc-94a0819fe3a0d679c3042a77bfe6a2afc505daea.tar.xz
rustc-94a0819fe3a0d679c3042a77bfe6a2afc505daea.zip
Adding upstream version 1.66.0+dfsg1.upstream/1.66.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--vendor/proc-macro2/src/wrapper.rs30
1 files changed, 20 insertions, 10 deletions
diff --git a/vendor/proc-macro2/src/wrapper.rs b/vendor/proc-macro2/src/wrapper.rs
index 750e156ff..47d149473 100644
--- a/vendor/proc-macro2/src/wrapper.rs
+++ b/vendor/proc-macro2/src/wrapper.rs
@@ -1,12 +1,12 @@
use crate::detection::inside_proc_macro;
use crate::{fallback, Delimiter, Punct, Spacing, TokenTree};
-use std::fmt::{self, Debug, Display};
-use std::iter::FromIterator;
-use std::ops::RangeBounds;
+use core::fmt::{self, Debug, Display};
+use core::iter::FromIterator;
+use core::ops::RangeBounds;
+use core::str::FromStr;
use std::panic;
#[cfg(super_unstable)]
use std::path::PathBuf;
-use std::str::FromStr;
#[derive(Clone)]
pub(crate) enum TokenStream {
@@ -350,12 +350,6 @@ impl Iterator for TokenTreeIter {
}
}
-impl Debug for TokenTreeIter {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- f.debug_struct("TokenTreeIter").finish()
- }
-}
-
#[derive(Clone, PartialEq, Eq)]
#[cfg(super_unstable)]
pub(crate) enum SourceFile {
@@ -511,6 +505,22 @@ impl Span {
}
}
+ #[cfg(super_unstable)]
+ pub fn before(&self) -> Span {
+ match self {
+ Span::Compiler(s) => Span::Compiler(s.before()),
+ Span::Fallback(s) => Span::Fallback(s.before()),
+ }
+ }
+
+ #[cfg(super_unstable)]
+ pub fn after(&self) -> Span {
+ match self {
+ Span::Compiler(s) => Span::Compiler(s.after()),
+ Span::Fallback(s) => Span::Fallback(s.after()),
+ }
+ }
+
pub fn join(&self, other: Span) -> Option<Span> {
let ret = match (self, other) {
#[cfg(proc_macro_span)]