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

Suppress dead code lint on custom token's span field #1602

Merged
merged 1 commit into from Mar 24, 2024
Merged

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Mar 24, 2024

syn::custom_keyword! produces potentially unused code if syn's "printing" feature is off, so that a ToTokens impl is not being generated.

This warning is new in nightly-2024-03-24 from rust-lang/rust#119552.

warning: field `span` is never read
    --> src/custom_keyword.rs:94:17
     |
94   |             pub span: $crate::__private::Span,
     |                 ^^^^
     |
    ::: src/expr.rs:1079:32
     |
1079 |         crate::custom_keyword!(builtin);
     |         -------------------------------
     |         |                      |
     |         |                      field in this struct
     |         in this macro invocation
     |
     = note: `#[warn(dead_code)]` on by default
     = note: this warning originates in the macro `crate::custom_keyword` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: field `span` is never read
    --> src/custom_keyword.rs:94:17
     |
94   |             pub span: $crate::__private::Span,
     |                 ^^^^
     |
    ::: src/expr.rs:1080:32
     |
1080 |         crate::custom_keyword!(raw);
     |         ---------------------------
     |         |                      |
     |         |                      field in this struct
     |         in this macro invocation
     |
     = note: this warning originates in the macro `crate::custom_keyword` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: field `span` is never read
        --> src/custom_keyword.rs:94:17
         |
    94   |             pub span: $crate::__private::Span,
         |                 ^^^^
         |
        ::: src/expr.rs:1079:32
         |
    1079 |         crate::custom_keyword!(builtin);
         |         -------------------------------
         |         |                      |
         |         |                      field in this struct
         |         in this macro invocation
         |
         = note: `#[warn(dead_code)]` on by default
         = note: this warning originates in the macro `crate::custom_keyword` (in Nightly builds, run with -Z macro-backtrace for more info)

    warning: field `span` is never read
        --> src/custom_keyword.rs:94:17
         |
    94   |             pub span: $crate::__private::Span,
         |                 ^^^^
         |
        ::: src/expr.rs:1080:32
         |
    1080 |         crate::custom_keyword!(raw);
         |         ---------------------------
         |         |                      |
         |         |                      field in this struct
         |         in this macro invocation
         |
         = note: this warning originates in the macro `crate::custom_keyword` (in Nightly builds, run with -Z macro-backtrace for more info)
@dtolnay dtolnay merged commit c218a35 into master Mar 24, 2024
28 checks passed
@dtolnay dtolnay deleted the deadcode branch March 24, 2024 03:19
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