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

Fix compilation on nightly #147

Merged
merged 1 commit into from
May 1, 2018
Merged

Conversation

konstin
Copy link
Member

@konstin konstin commented May 1, 2018

rust-lang/rust#50120 has made two breaking changes that break pyo3's compilation:

  • Custom attributes must only have a path of length one, longer paths got an extra feature gate proc_macro_path_invoc. This means that e.g. #[py::modinit(rust2py)] fails to compile.
  • The attr TokenStream no longer gets the braces, e.g. it now only gets rust2py and not (rust2py).

This pull request fixes both. I've tried to avoid introducing breaking changes and instead replaced py::modinit with a pymodinit alias. I wouldn't mind removing the alias or renaming the proc macros.

// add bindings to the generated python module
// N.B: names: "librust2py" must be the name of the `.so` or `.pyd` file
/// This module is implemented in Rust.
#[py::modinit(rust2py)]
#[pymodinit(rust2py)]
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason for this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

py::modinit doesn't work without the proc_macro_path_invoc feature, which isn't expected to be stabilized soon (unlike proc macros and specialization).

Copy link
Contributor

Choose a reason for hiding this comment

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

I see

@fafhrd91
Copy link
Contributor

fafhrd91 commented May 1, 2018

you should have permission to merge

@konstin
Copy link
Member Author

konstin commented May 1, 2018

Yes, thanks!

@konstin konstin merged commit 4735c2c into PyO3:master May 1, 2018
@konstin konstin deleted the proc_macro_path_invoc branch May 1, 2018 16:59
konstin added a commit that referenced this pull request May 1, 2018
This is a follow-up to #147
@konstin
Copy link
Member Author

konstin commented May 1, 2018

@fafhrd91 Do you have any policy on when to make pull requests and when to directly push to master?

@fafhrd91
Copy link
Contributor

fafhrd91 commented May 1, 2018

I don't really have any policy, but master branch is protected :)
I prefer for someone to review PR before merge

@fafhrd91
Copy link
Contributor

fafhrd91 commented May 1, 2018

@konstin @althonos I think you should be able to review PRs

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.

2 participants