-
Notifications
You must be signed in to change notification settings - Fork 524
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
prost-derive: compatible with "nightly" proc-macro2 #89
Conversation
proc-macro2 0.3 tries to be compatible with the non-nightly 0.2 versions, even if the nightly feature is enabled. This fixes compile errors when another dependency requires the "nightly" feature of proc-macro2.
The new 0.3 proc-macro2 makes it easy to be compatible using different feature sets. ("nightly" versus "non-nightly"), I could revert most of the required changes by updating dependencies. |
It would be great to see this merged! @danburkert any blockers? I'm using the |
@@ -696,7 +696,7 @@ impl DefaultValue { | |||
DefaultValue::String(ref value) => quote!(#value.to_owned()), | |||
DefaultValue::Bytes(ref value) if value.is_empty() => quote!(::std::vec::Vec::new()), | |||
DefaultValue::Bytes(ref value) => { | |||
let lit = LitByteStr::new(value, Span::def_site()); | |||
let lit = LitByteStr::new(value, Span::call_site()); |
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.
Just curious, do you know of any resources that document what the actual difference is here? I was mostly guessing we I introduced this during the syn 0.11 to 0.12 transition.
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.
call_site() will mean what def_site() meant previously, everything is unhygienic (visible from outside the macro). The def_site() will be hygienic, invisible from outside. But that is not currently possible on stable, that's a nightly-only feature. Macros 2.0 will be finalized before Rust 2018 (so in the next few months) and after that it will be possible to write hygienic macros too.
Looks good. I tried to think of a way this could be regression tested, but came up short. @ngg do you know any ways it could be tested? |
Probably you could add a "nightly" feature to prost-derive which would depend on the "nightly" feature of proc-macro2 and you could run tests with this feature too on travis |
This fixes compatibility with proc-macro2 if it has its "nightly"
feature enabled (it can be if another crate requires it).
Closes #88.