diff --git a/src/lit.rs b/src/lit.rs index 24524bb1f4..9addf1d370 100644 --- a/src/lit.rs +++ b/src/lit.rs @@ -225,10 +225,11 @@ impl LitStr { // Parse string literal into a token stream with every span equal to the // original literal's span. + let span = self.span(); let mut tokens = TokenStream::from_str(&self.value())?; - tokens = respan_token_stream(tokens, self.span()); + tokens = respan_token_stream(tokens, span); - let result = parser.parse2(tokens)?; + let result = crate::parse::parse_scoped(parser, span, tokens)?; let suffix = self.suffix(); if !suffix.is_empty() { diff --git a/src/parse.rs b/src/parse.rs index 13f488d143..d539e192f7 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -1268,7 +1268,6 @@ pub trait Parser: Sized { // Not public API. #[doc(hidden)] - #[cfg(any(feature = "full", feature = "derive"))] fn __parse_scoped(self, scope: Span, tokens: TokenStream) -> Result { let _ = scope; self.parse2(tokens) @@ -1300,7 +1299,6 @@ where } } - #[cfg(any(feature = "full", feature = "derive"))] fn __parse_scoped(self, scope: Span, tokens: TokenStream) -> Result { let buf = TokenBuffer::new2(tokens); let cursor = buf.begin(); @@ -1316,7 +1314,6 @@ where } } -#[cfg(any(feature = "full", feature = "derive"))] pub(crate) fn parse_scoped(f: F, scope: Span, tokens: TokenStream) -> Result { f.__parse_scoped(scope, tokens) }