Skip to content

Fix various proc-macro bugs #4029

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 3 commits into from
Apr 18, 2020
Merged

Conversation

edwin0cheng
Copy link
Member

@edwin0cheng edwin0cheng commented Apr 18, 2020

This PRs does the following things:

  1. Fixed thread '<unnamed>' panicked at 'called Option::unwrap() on a None value', crates/ra_mbe/src/subtree_source.rs:155:16 #4001 by splitting LIFETIME lexer token to two mbe tokens. It is because rustc token stream expects LIFETIME as a combination of punct and ident, but RA tt:TokenTree treats it as a single Ident previously.
  2. Fixed thread '<unnamed>' panicked at 'MacroDef without ast_id', crates/ra_hir/src/has_source.rs:109:22 #4003, by skipping proc-macro for completion. It is because currently we don't have AstNode for proc-macro. We would need to redesign how to implement HasSource for proc-macro.
  3. Fixed a bug how empty TokenStream merging in proc-macro-srv such that no L_DOLLAR and R_DOLLAR will be emitted accidentally.

@edwin0cheng
Copy link
Member Author

I found that serde defined a try! macro in the expanded code such that it is syntax error (#2241) in RA currently.

@matklad
Copy link
Member

matklad commented Apr 18, 2020

bors r+

Would be good to add a test for lifetime splitting though!

@bors
Copy link
Contributor

bors bot commented Apr 18, 2020

@bors bors bot merged commit 98819d8 into rust-lang:master Apr 18, 2020
@edwin0cheng edwin0cheng deleted the fix-proc-macro-bugs branch April 18, 2020 18:29
@edwin0cheng
Copy link
Member Author

lifetime splitting test added in #4032

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants