Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make LitCStr peekable #1682

Merged
merged 1 commit into from
Jun 20, 2024
Merged

Make LitCStr peekable #1682

merged 1 commit into from
Jun 20, 2024

Conversation

dtolnay
Copy link
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
29 checks passed
@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.

None yet

1 participant