Skip to content

Make LitCStr peekable#1682

Merged
dtolnay merged 1 commit intomasterfrom
peekcstr
Jun 20, 2024
Merged

Make LitCStr peekable#1682
dtolnay merged 1 commit intomasterfrom
peekcstr

Conversation

@dtolnay
Copy link
Copy Markdown
Owner

@dtolnay dtolnay commented Jun 20, 2024

Previously input.peek(syn::LitStr) worked but input.peek(syn::LitCStr) would fail to compile.

error[E0277]: the trait bound `LitCStr: CustomToken` is not satisfied
   --> src/lib.rs:7:19
    |
7   |     if input.peek(syn::LitCStr) {
    |              ---- ^^^^^^^^^^^^ the trait `CustomToken` is not implemented for `LitCStr`, which is required by `fn(syn::lookahead::TokenMarker) -> LitCStr {LitCStr}: Peek`
    |              |
    |              required by a bound introduced by this call
    |
    = help: the following other types implement trait `CustomToken`:
              syn::expr::parsing::kw::builtin
              syn::expr::parsing::kw::raw
              syn::ext::private::IdentAny
    = note: required for `LitCStr` to implement `Token`
    = note: required for `fn(syn::lookahead::TokenMarker) -> LitCStr {LitCStr}` to implement `Peek`
note: required by a bound in `ParseBuffer::<'a>::peek`
   --> .cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.66/src/parse.rs:580:20
    |
580 |     pub fn peek<T: Peek>(&self, token: T) -> bool {
    |                    ^^^^ required by this bound in `ParseBuffer::<'a>::peek`

@dtolnay dtolnay merged commit 26ce3d9 into master Jun 20, 2024
@dtolnay dtolnay deleted the peekcstr branch June 20, 2024 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant