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

Use proc_macro2::Span::call_site for all quotes #77

Merged

Conversation

fitzgen
Copy link
Contributor

@fitzgen fitzgen commented Mar 1, 2018

This avoids breakage when deriving StructOpt when proc_macro2's nightly feature is enabled. See dtolnay/proc-macro2#67 for details.

cc @alexcrichton

@fitzgen fitzgen force-pushed the proc-macro2-nightly-feature-workaround branch 2 times, most recently from 3c80b6c to 733ff4f Compare March 1, 2018 19:58
Copy link
Owner

@TeXitoi TeXitoi left a comment

Choose a reason for hiding this comment

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

Please also update CHANGELOG.md with your change.

Looks like a dirty workaround, I have to read some doc to understand the problem properly.

@@ -0,0 +1,3 @@
macro_rules! my_quote {
($($t:tt)*) => (quote_spanned!(::proc_macro2::Span::call_site() => $($t)*))
}
Copy link
Owner

Choose a reason for hiding this comment

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

If you had a file, you should add the header. But maybe for that, just defining it in lib.rs is OK.

@TeXitoi
Copy link
Owner

TeXitoi commented Mar 1, 2018

Travis should also be updated to test with the problematic feature, no?

@fitzgen fitzgen force-pushed the proc-macro2-nightly-feature-workaround branch from 733ff4f to a3409f2 Compare March 1, 2018 22:46
This avoids breakage when deriving `StructOpt` when `proc_macro2`'s nightly
feature is enabled. See dtolnay/proc-macro2#67
for details.
@fitzgen fitzgen force-pushed the proc-macro2-nightly-feature-workaround branch from a3409f2 to a028c45 Compare March 1, 2018 22:48
@fitzgen
Copy link
Contributor Author

fitzgen commented Mar 1, 2018

Added

  • license header
  • changelog entry
  • travis ci test coverage

@alexcrichton
Copy link

FWIW This isn't so much a workaround as necessary today based on today's hygiene implementation, otherwise fixing this without changing span information would require far more intrusive changes to structopt which'd probably want to be delated for later :)

@TeXitoi
Copy link
Owner

TeXitoi commented Mar 7, 2018

OK. I tried to look at it, but didn't really understand why it doesn't find std. If you know of any doc on that or any similar problem fixed in another project, I would be interested to look at it for my own curiosity.

@TeXitoi TeXitoi merged commit f9a7651 into TeXitoi:master Mar 7, 2018
@TeXitoi
Copy link
Owner

TeXitoi commented Mar 7, 2018

v0.2.5 published

@alexcrichton
Copy link

@TeXitoi rust-lang/rust#45934 may have a bit more of a writeup if you're interested to dig more!

@TeXitoi
Copy link
Owner

TeXitoi commented Mar 8, 2018

Thanks

@fitzgen fitzgen deleted the proc-macro2-nightly-feature-workaround branch April 17, 2018 22:22
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

3 participants