From 28915db5f27d64c0bdcf47c57c5d978c82f9e449 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 31 Mar 2021 23:54:14 -0400 Subject: [PATCH] Preserve span of LexError on conversion to syn::Error --- Cargo.toml | 2 +- src/error.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 65ba055a0c..934f134a4b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ proc-macro = ["proc-macro2/proc-macro", "quote/proc-macro"] test = ["syn-test-suite/all-features"] [dependencies] -proc-macro2 = { version = "1.0.23", default-features = false } +proc-macro2 = { version = "1.0.26", default-features = false } quote = { version = "1.0", optional = true, default-features = false } unicode-xid = "0.2" diff --git a/src/error.rs b/src/error.rs index 6051f3b686..780731c86c 100644 --- a/src/error.rs +++ b/src/error.rs @@ -349,7 +349,7 @@ impl std::error::Error for Error {} impl From for Error { fn from(err: LexError) -> Self { - Error::new(Span::call_site(), format!("{:?}", err)) + Error::new(err.span(), "lex error") } }