-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Use $crate
prepend to make importing the _clap_count_exprs
macro unnecessary
#1397
Conversation
Could this fix use |
@hcpl: Several wrapper macros would need to be generated for usages of several macros in diff --git a/src/macros.rs b/src/macros.rs
index 0f9e755c..1962c76a 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -303,7 +303,7 @@ macro_rules! _clap_count_exprs {
/// [`Display`]: https://doc.rust-lang.org/std/fmt/trait.Display.html
/// [`std::fmt::Display`]: https://doc.rust-lang.org/std/fmt/trait.Display.html
/// [`Arg::case_insensitive(true)`]: ./struct.Arg.html#method.case_insensitive
-#[macro_export]
+#[macro_export(local_inner_macros)]
macro_rules! arg_enum {
(@as_item $($i:item)*) => ($($i)*);
(@impls ( $($tts:tt)* ) -> ($e:ident, $($v:ident),+)) => { ...these are the macros that currently fail:
My main concern is the sheer number of changes that fixing compile errors after applying this diff would entail -- there are 48 places where macro expansion fails after applying this diff. The solution using |
While you are right about boilerplate to work around external macro usages being cumbersome, I was more worried about using a latest Rust-only feature. This forces users to get the latest Rust to build So IMO taking the burden off from users (requiring them to have Rust 1.32+) to the library (maintaining |
Maybe-not-minor nitpick:
That would technically be Rust 1.30+. :) To your point: ack, I wasn't thinking about non- |
Debian's stable release channel uses Rust 1.24.0. Fedora's oldest supported version is 28, and the oldest version of Ubuntu's oldest supported version is Trusty (14.04), which uses Rust 1.28. Gentoo's oldest supported Rust version is Rust 1.29.1. openSUSE's oldest version of their OpenBSD's oldest supported version is 6.2, and the oldest version I can find on the supported architectures is Rust 1.20.0 |
@hcpl: So, back to this point of yours:
The policy of this crate is to support at most two versions BEFORE latest. Even the theoretically current minimum of Rust 1.29 would break every Linux/BSD distro I found above except Gentoo. |
Oh derp, I should have read more carefully :).
Yeah, I should have pointed out the "latest stable - 2" policy being explicitly mentioned in README in my comments, but oh well. When writing comments above, I had the mindset of "even in presense of a lenient policy, don't break unless something external (e.g. dependencies) forces you because doing so is in good taste for users". But that's me being too conservative about not upsetting users which can be a bad thing (my policy would accumulate more technical debt over time, for example). In the end, I'm totally fine with what you are doing here since it complies with the library policy and my point about doing a little more that you promised to is not applicable to everyone. |
Just wanted to ping this issue again, since Rust 1.32 has now released and this should be good to go! |
Wanted to say that PR apparently doesn't compile on nightly, but the fail is in |
Is this PR going to be fixed/merged? I just stumbled into this in a new project and feel dirty using "private" macros. |
I'm not sure. There's been radio silence the last couple of months... :\ |
Some discussion has been happening here on Reddit, initiated by @mkpankov: https://www.reddit.com/r/rust/comments/b575hi/is_clap_maintained/ejdawiv/ TL;DR: @kbknapp has been focusing the few hours per week he's had on |
@ErichDonGubler hey there, yea I'll try to get this today :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Just wanted to give a shout-out to @kbknapp and @spacekookie for taking the time to make things transparent -- it took a while, but it was because life happens and other priorities do come up! I feel good about the outcome here, and I hope others do too. :) |
Resolves #1329, using the
$crate::
keyword that was stabilized with Rust 1.30.0.NOTE: This should be merged on or after the day of the Rust 1.32 (probably 2019-01-21, 6 weeks after 1.31.0 released) release in order to maintain the
supports($LATEST - 2)
minimum Rust compiler policy.