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

Replace proc-macro-error with proc-macro2-diagnostics #536

Closed
wants to merge 5 commits into from

Conversation

tamird
Copy link

@tamird tamird commented Jan 7, 2024

See individual commits.

I realize this crate is deprecated in favor of clap, but it still seems to
enjoy some 10,000-40,000 downloads per day over the past three months. Updating
to syn@2 is likely to have positive effect on compilation time for dependents.

See https://crates.io/crates/structopt-derive for download graphs.

tamird added 5 commits January 7, 2024 17:46
```
TRYBUILD=overwrite cargo test
```
```
warning: unnecessary parentheses around match arm expression
   --> structopt-derive/src/parse.rs:177:28
    |
177 |                 "about" => (Ok(About(name, None))),
    |                            ^                     ^
    |
    = note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
    |
177 -                 "about" => (Ok(About(name, None))),
177 +                 "about" => Ok(About(name, None)),
    |

warning: unnecessary parentheses around match arm expression
   --> structopt-derive/src/parse.rs:178:29
    |
178 |                 "author" => (Ok(Author(name, None))),
    |                             ^                      ^
    |
help: remove these parentheses
    |
178 -                 "author" => (Ok(Author(name, None))),
178 +                 "author" => Ok(Author(name, None)),
    |
```
```
warning: the following explicit lifetimes could be elided: 'a
    --> src/lib.rs:1205:24
     |
1205 |     fn from_subcommand<'a, 'b>(_sub: (&'b str, Option<&'b clap::ArgMatches<'a>>)) -> Option<Self>
     |                        ^^                                                  ^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
     = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
     |
1205 -     fn from_subcommand<'a, 'b>(_sub: (&'b str, Option<&'b clap::ArgMatches<'a>>)) -> Option<Self>
1205 +     fn from_subcommand<'b>(_sub: (&'b str, Option<&'b clap::ArgMatches<'_>>)) -> Option<Self>
     |

warning: the following explicit lifetimes could be elided: 'a
    --> src/lib.rs:1230:24
     |
1230 |     fn from_subcommand<'a, 'b>(sub: (&'b str, Option<&'b clap::ArgMatches<'a>>)) -> Option<Self> {
     |                        ^^                                                 ^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
     |
1230 -     fn from_subcommand<'a, 'b>(sub: (&'b str, Option<&'b clap::ArgMatches<'a>>)) -> Option<Self> {
1230 +     fn from_subcommand<'b>(sub: (&'b str, Option<&'b clap::ArgMatches<'_>>)) -> Option<Self> {
     |
```
proc-macro-error is unmaintained, and structopt-derive is by far its
most popular dependent. See
https://crates.io/crates/proc-macro-error/reverse_dependencies.
@tamird
Copy link
Author

tamird commented Mar 14, 2024

@TeXitoi could you have a look please?

@TeXitoi
Copy link
Owner

TeXitoi commented Mar 14, 2024

That’s a big change for a frozen crate. I’ll try to have a look, but no promise.

@@ -1,18 +1,10 @@
error: `#[structopt(raw(...))` attributes are removed in structopt 0.3, they are replaced with raw methods

= help: if you meant to call `clap::Arg::raw()` method you should use bool literal, like `raw(true)` or `raw(false)`
= note: if you need to call `clap::Arg/App::case_insensitive` method you can do it like this: #[structopt(case_insensitive = true)]
Copy link
Owner

Choose a reason for hiding this comment

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

This is a regression

Copy link
Author

Choose a reason for hiding this comment

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

Yes, and one that I've called out here.

Copy link

Choose a reason for hiding this comment

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

That regression should be noted in a CHANGELOG.md entry ?

Copy link
Author

Choose a reason for hiding this comment

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

Would that unblock this PR?

Copy link
Owner

Choose a reason for hiding this comment

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

No regression allowed for a crate in maintenance just to optimize compilation time. Better to migrate to clap if you want to improve compilation times.

@epage
Copy link
Contributor

epage commented Mar 14, 2024

I realize this crate is deprecated in favor of clap, but it still seems to
enjoy some 10,000-40,000 downloads per day over the past three months. Updating
to syn@2 is likely to have positive effect on compilation time for dependents.

imo that effort would be better spent migrating some of the more popular users.

@tamird
Copy link
Author

tamird commented Mar 14, 2024

You mean like this?
rust-lang/git2-rs#1007
brendanzab/codespan#357
marshallpierce/rust-base64#262

@TeXitoi
Copy link
Owner

TeXitoi commented Sep 30, 2024

I close this MR as there is no activity.

@TeXitoi TeXitoi closed this Sep 30, 2024
@tamird
Copy link
Author

tamird commented Sep 30, 2024

If you can close it, maybe you can also review and accept it?

@TeXitoi
Copy link
Owner

TeXitoi commented Sep 30, 2024

Sorry. I don't want a regression, and there is one.

Also, I'm quite anxious at this PR as this is a big library change, and it might cause a behavior change.

I know that you worked in this and that closing this deny your work, but it adds more risk than advantages for my point of view.

@tamird
Copy link
Author

tamird commented Sep 30, 2024

Ack. Salvaged some useful stuff into #542 + added GitHub CI.

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.

4 participants