Skip to content

Conversation

edwin0cheng
Copy link
Contributor

@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
difference = "2.0.0"
# used as proc macro test target
serde_derive = "=1.0.104"
serde_derive = "=1.0.104"
Copy link
Contributor

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
Contributor 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
Contributor 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
Contributor

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