Skip to content

Commit b120971

Browse files
committed
Unimportant lex errors in wrapper codepath
1 parent 5abe9c1 commit b120971

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/fallback.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@ pub(crate) struct LexError {
4040
}
4141

4242
impl LexError {
43-
// Codepaths that will need a meaningful span attached as part of
44-
// https://github.com/alexcrichton/proc-macro2/issues/178
45-
pub(crate) fn todo() -> Self {
46-
LexError {
47-
span: Span::call_site(),
48-
}
49-
}
50-
5143
pub(crate) fn span(&self) -> Span {
5244
self.span
5345
}

src/wrapper.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@ impl FromStr for TokenStream {
108108
// Work around https://github.com/rust-lang/rust/issues/58736.
109109
fn proc_macro_parse(src: &str) -> Result<proc_macro::TokenStream, LexError> {
110110
let result = panic::catch_unwind(|| src.parse().map_err(LexError::Compiler));
111-
result.unwrap_or_else(|_| Err(LexError::Fallback(fallback::LexError::todo())))
111+
result.unwrap_or_else(|_| {
112+
Err(LexError::Fallback(fallback::LexError {
113+
span: fallback::Span::call_site(),
114+
}))
115+
})
112116
}
113117

114118
impl Display for TokenStream {
@@ -279,7 +283,12 @@ impl Display for LexError {
279283
#[cfg(lexerror_display)]
280284
LexError::Compiler(e) => Display::fmt(e, f),
281285
#[cfg(not(lexerror_display))]
282-
LexError::Compiler(_e) => Display::fmt(&fallback::LexError::todo(), f),
286+
LexError::Compiler(_e) => Display::fmt(
287+
&fallback::LexError {
288+
span: fallback::Span::call_site(),
289+
},
290+
f,
291+
),
283292
LexError::Fallback(e) => Display::fmt(e, f),
284293
}
285294
}

0 commit comments

Comments
 (0)