Skip to content

Implement expand_task and list_macros in proc_macro_srv #3920

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

Merged
merged 7 commits into from
Apr 11, 2020

Conversation

edwin0cheng
Copy link
Member

@edwin0cheng edwin0cheng commented Apr 9, 2020

This PR finish up the remain proc_macro_srv implementation :

  1. Added dylib loading code for proc-macro crate dylib. Note that we have to add some special flags for unix loading because of a bug in old version of glibc, see Some notes about the panic fedochet/rust-proc-macro-panic-inside-panic-expample#1 and Panic inside panic when procedural macro is called with proc_macro::bridge::client rust#60593 for details.

  2. Added tests for proc-macro expansion: We use a trick here by adding serde_derive to dev-dependencies and calling cargo-metadata for searching its dylib path, and expand it in our tests.

[EDIT]
Note that this PR DO NOT implement the final glue code with rust-analzyer and proc-macro-srv yet.

@edwin0cheng edwin0cheng force-pushed the impl-proc-macro-srv branch from 7383503 to 197039b Compare April 9, 2020 18:06
serde_derive = "=1.0.104"
Copy link
Member

Choose a reason for hiding this comment

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

Hm, why we use an = dep here?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is because we want to lock the version of proc macro to test with. They would change whatSerialize to expand which may change the test result.

@edwin0cheng
Copy link
Member Author

edwin0cheng commented Apr 11, 2020

I changed to use std::io::Error for all dylib loading code and fixed other nits too.

@matklad
Copy link
Member

matklad commented Apr 11, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 11, 2020

@bors bors bot merged commit 0ecdba2 into rust-lang:master Apr 11, 2020
@edwin0cheng edwin0cheng deleted the impl-proc-macro-srv branch April 11, 2020 12:43
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.

3 participants