Skip to content

quasi-quoting a block expression doesn't work #26994

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
nrc opened this issue Jul 12, 2015 · 4 comments
Closed

quasi-quoting a block expression doesn't work #26994

nrc opened this issue Jul 12, 2015 · 4 comments
Labels
A-syntaxext Area: Syntax extensions C-bug Category: This is a bug. P-low Low priority

Comments

@nrc
Copy link
Member

nrc commented Jul 12, 2015

quote_expr!(self.cx, { $result_name = Some($expr); break $loop_label; }) failed with error: expected one of.,;,}, or an operator, found'__hoare_2``(__hoare_2is the expected value of`$loop_label`). This failed in expansion so I couldn't get an expanded AST to find out what was going on.

The work around:

                let stmts = vec![quote_stmt!(self.cx, $result_name = Some($expr);).unwrap(),
                                 quote_stmt!(self.cx, break $loop_label;).unwrap()];
                self.cx.expr_block(self.cx.block(stmts[0].span, stmts, None))

worked fine

@nrc nrc added the A-syntaxext Area: Syntax extensions label Jul 12, 2015
@nrc
Copy link
Member Author

nrc commented Jul 12, 2015

I think this has something to do with the ident loop_label, quasi-quoting is not pasting it into the break label position correctly. I previously had similar problems when I forgot to start the label name with a ', but that is not the problem here.

Note that the 'correct' version above compiles without an error, but generates incorrect code - no label to break to. If I build that part of the AST by hand, then it works fine.

@brson brson added the P-low Low priority label Jan 12, 2017
@brson
Copy link
Contributor

brson commented Jan 12, 2017

@nrc do you still care about this issue. Seems like an internal defect that doesn't much matter.

@nrc
Copy link
Member Author

nrc commented Jan 12, 2017

It's not entirely internal since syntax extensions can use quasi-quoting. I suppose this will get 'fixed' when we change to token based quasi-quoting, but until then I think this is relevant

@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 22, 2017
@steveklabnik
Copy link
Member

Triage: being removed in #51285

bors added a commit that referenced this issue Dec 8, 2018
Remove quote_*! macros

This deletes a considerable amount of test cases, some of which we may want to keep. I'm not entirely certain what the primary intent of many of them was; if we should keep them I can attempt to edit each case to continue compiling without the quote_*! macros involved.

Fixes #46849.
Fixes #12265.
Fixes #12266.
Fixes #26994.

r? @Manishearth
bors added a commit that referenced this issue Jan 23, 2019
Remove quote_*! macros

This deletes a considerable amount of test cases, some of which we may want to keep. I'm not entirely certain what the primary intent of many of them was; if we should keep them I can attempt to edit each case to continue compiling without the quote_*! macros involved.

Fixes #46849.
Fixes #12265.
Fixes #12266.
Fixes #26994.

r? @Manishearth
@bors bors closed this as completed in 01f8e25 Jan 24, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-syntaxext Area: Syntax extensions C-bug Category: This is a bug. P-low Low priority
Projects
None yet
Development

No branches or pull requests

4 participants