Lines Matching defs:LexError
28 pub(crate) enum LexError {
29 Compiler(proc_macro::LexError),
30 Fallback(fallback::LexError),
32 // Rustc was supposed to return a LexError, but it panicked instead.
109 type Err = LexError;
111 fn from_str(src: &str) -> Result<TokenStream, LexError> {
123 fn proc_macro_parse(src: &str) -> Result<proc_macro::TokenStream, LexError> {
124 let result = panic::catch_unwind(|| src.parse().map_err(LexError::Compiler));
125 result.unwrap_or_else(|_| Err(LexError::CompilerPanic))
260 impl LexError {
263 LexError::Compiler(_) | LexError::CompilerPanic => Span::call_site(),
264 LexError::Fallback(e) => Span::Fallback(e.span()),
269 impl From<proc_macro::LexError> for LexError {
270 fn from(e: proc_macro::LexError) -> Self {
271 LexError::Compiler(e)
275 impl From<fallback::LexError> for LexError {
276 fn from(e: fallback::LexError) -> Self {
277 LexError::Fallback(e)
281 impl Debug for LexError {
284 LexError::Compiler(e) => Debug::fmt(e, f),
285 LexError::Fallback(e) => Debug::fmt(e, f),
286 LexError::CompilerPanic => {
287 let fallback = fallback::LexError::call_site();
294 impl Display for LexError {
297 LexError::Compiler(e) => Display::fmt(e, f),
298 LexError::Fallback(e) => Display::fmt(e, f),
299 LexError::CompilerPanic => {
300 let fallback = fallback::LexError::call_site();
901 type Err = LexError;