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

Is proc_macro_hygiene still needed? #30

Closed
HadrienG2 opened this issue Jan 31, 2021 · 5 comments
Closed

Is proc_macro_hygiene still needed? #30

HadrienG2 opened this issue Jan 31, 2021 · 5 comments

Comments

@HadrienG2
Copy link

I recently ended up on this library, and noticed that it did not compile on stable due to use of the proc_macro_hygiene nightly feature.

Since there's been some movement on proc macro stabilization recently, I figured I'd just try to remove the feature gate and see what happens, and the result builds on stable and seems to produce correct mathematical results (validated against rug/MPFR).

Are you sure you still need this feature gate?

@jkarns275
Copy link
Owner

jkarns275 commented Jan 31, 2021

So I'm not entirely sure what i even used that for. This is where the proc_macro gets used to construct the f128 input macro

f128/src/lib.rs

Lines 9 to 15 in b5012f0

#[macro_export]
macro_rules! f128 {
($e:expr) => (f128_inner!($e));
($f:expr, $($e:expr),+) => ((f128_inner!($f), $(f128_inner!($e)),+));
[$f:expr, $($e:expr),+] => ([f128_inner!($f), $(f128_inner!($e)),+]);
[$f:expr; $l:expr] => ([f128_inner!($f); $l]);
}

Does this look like it would compile on stable? (where f128_inner is a proc_macro)
I haven't been keeping up with the new versions of rust lately

@HadrienG2
Copy link
Author

This looks like the "fn-like proc macro expanding to an expression or statement" feature gate, which was stabilized last summer through this PR that shipped in Rust 1.45 last July.

And empirically speaking, I checked that if I just remove the feature gate, the crate builds on stable and seems to behave as intended.

@jkarns275
Copy link
Owner

Alright, I'll remove this and push out a new version of the crate today. Thanks for pointing this out.

@jkarns275
Copy link
Owner

Okay this was fixed with ebd3b21

@HadrienG2
Copy link
Author

Thanks!

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

No branches or pull requests

2 participants