Skip to content

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

Closed
@nrc

Description

@nrc

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-syntaxextArea: Syntax extensionsC-bugCategory: This is a bug.P-lowLow priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions