-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 #54707 - parse_trait_item_ now handles interpolated blocks as function body decls #54850
Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls #54850
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Can you add some form of test, @mcr431 ? |
Whoa, |
@nikomatsakis sorry about that will add a test and update pr this evening. |
dce7980
to
cf60a29
Compare
@nikomatsakis added a test, let me know if you'd like any more or if it should be in a different spot. first time adding a new test. |
|
||
trait Foo { | ||
def_fn!({ println!("bar"); }); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks =) I think it'd be good to include in the text the other various places one might use this as well -- e.g., for a free function etc. Skimming the existing tests I did find that macros/macro-interpolation.rs
and macros/macro-stmt
both test the free fn case but there don't appear to be tests in impls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be good to just have one single test dedicated to testing that $b
can be used as a fn body in all relevant contexts (the other tests are kind of testing a wider variety of things)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feeback. will update and let you know when its ready
cf60a29
to
3447473
Compare
@nikomatsakis I made a new test file: |
edit: not sure how to change it from S-waiting-on-author to S-waiting-on-review |
@bors r+ |
📌 Commit 3447473 has been approved by |
…m-macro, r=nikomatsakis Fix rust-lang#54707 - parse_trait_item_ now handles interpolated blocks as function body decls Fix rust-lang#54707 - parse_trait_item_ now handles interpolated blocks as function body decls Previously parsing trait items only handled opening brace token and semicolon, I added a branch to the match statement that will also handle interpolated blocks.
…m-macro, r=nikomatsakis Fix rust-lang#54707 - parse_trait_item_ now handles interpolated blocks as function body decls Fix rust-lang#54707 - parse_trait_item_ now handles interpolated blocks as function body decls Previously parsing trait items only handled opening brace token and semicolon, I added a branch to the match statement that will also handle interpolated blocks.
Rollup of 9 pull requests Successful merges: - #54747 (codegen_llvm: verify that inline assembly operands are scalars) - #54848 (Better Diagnostic for Trait Object Capture) - #54850 (Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls) - #54858 (second round of refactorings for universes) - #54862 (Implement RFC 2539: cfg_attr with multiple attributes) - #54869 (Fix mobile docs) - #54870 (Stabilize tool lints) - #54893 (Fix internal compiler error on malformed match arm pattern.) - #54904 (Stabilize the `Option::replace` method) Failed merges: - #54909 ( Add chalk rules related to associated type defs) r? @ghost
Rollup of 9 pull requests Successful merges: - #54747 (codegen_llvm: verify that inline assembly operands are scalars) - #54848 (Better Diagnostic for Trait Object Capture) - #54850 (Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls) - #54858 (second round of refactorings for universes) - #54862 (Implement RFC 2539: cfg_attr with multiple attributes) - #54869 (Fix mobile docs) - #54870 (Stabilize tool lints) - #54893 (Fix internal compiler error on malformed match arm pattern.) - #54904 (Stabilize the `Option::replace` method) Failed merges: - #54909 ( Add chalk rules related to associated type defs) r? @ghost
…nikomatsakis Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls Previously parsing trait items only handled opening brace token and semicolon, I added a branch to the match statement that will also handle interpolated blocks.
☀️ Test successful - status-appveyor, status-travis |
Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls
Previously parsing trait items only handled opening brace token and semicolon, I added a branch to the match statement that will also handle interpolated blocks.