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

config_proc_macro: reduce syn's features #6237

Merged
merged 2 commits into from
Sep 12, 2024
Merged

Conversation

klensy
Copy link
Contributor

@klensy klensy commented Jul 11, 2024

This reduces syn's features to "full", "parsing", "proc-macro", "printing" only for that proc macro.

Also bumped edition to 2021.

Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not sufficient features for this macro. When I build this, I get:

error[E0432]: unresolved import `syn::parse_macro_input`
   --> config_proc_macro/src/lib.rs:14:5
    |
14  | use syn::parse_macro_input;
    |     ^^^^^^^^^^^^^^^^^^^^^^ no `parse_macro_input` in the root
    |
note: found an item that was configured out
   --> ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.72/src/lib.rs:465:5
    |
465 | mod parse_macro_input;
    |     ^^^^^^^^^^^^^^^^^
note: the item is gated here
   --> ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.72/src/lib.rs:464:1
    |
464 | #[cfg(all(feature = "parsing", feature = "proc-macro"))]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

and many other errors.

@klensy
Copy link
Contributor Author

klensy commented Jul 30, 2024

Hmm, yes, this shouldn't work, but locally compiles. Something somewhere merging features?

$ pwd
/g/projs/rustfmt/config_proc_macro
$ cargo b
   Compiling proc-macro2 v1.0.63
   Compiling unicode-ident v1.0.8
   Compiling quote v1.0.26
   Compiling syn v2.0.14
   Compiling rustfmt-config_proc_macro v0.3.0 (G:\projs\rustfmt\config_proc_macro)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 4.25s
$ cargo tree -p syn -i -e features,normal
syn v2.0.14
`-- syn feature "full"
    `-- rustfmt-config_proc_macro v0.3.0 (proc-macro) (G:\projs\rustfmt\config_proc_macro)
        `-- rustfmt-config_proc_macro feature "default" (command-line)

/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-2.0.72/ aha, so you at least bumped deps here, is there any more changes?

Looks like you bumped edition to 2021, and it stopped building, nice!

@klensy
Copy link
Contributor Author

klensy commented Jul 30, 2024

Bumping edition to 2021 (which sets cargo resolver to 2?) allowed to discover actually wrong feature set of features.

Copy link
Contributor

@ytmimi ytmimi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Edit: Diff-Check passed ✅

@ytmimi ytmimi added pr-ready-to-merge release-notes Needs an associated changelog entry and removed pr-not-reviewed labels Sep 12, 2024
@ytmimi ytmimi merged commit 16f0ecc into rust-lang:master Sep 12, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-ready-to-merge release-notes Needs an associated changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants