Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/lit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
3 changes: 0 additions & 3 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self::Output> {
let _ = scope;
self.parse2(tokens)
Expand Down Expand Up @@ -1300,7 +1299,6 @@ where
}
}

#[cfg(any(feature = "full", feature = "derive"))]
fn __parse_scoped(self, scope: Span, tokens: TokenStream) -> Result<Self::Output> {
let buf = TokenBuffer::new2(tokens);
let cursor = buf.begin();
Expand All @@ -1316,7 +1314,6 @@ where
}
}

#[cfg(any(feature = "full", feature = "derive"))]
pub(crate) fn parse_scoped<F: Parser>(f: F, scope: Span, tokens: TokenStream) -> Result<F::Output> {
f.__parse_scoped(scope, tokens)
}
Expand Down