syn icon indicating copy to clipboard operation
syn copied to clipboard

Is there any plan to fully support let-else?

Open TennyZhuang opened this issue 3 years ago • 1 comments

Currently, let_else will be treated as ExprVerbatim:

[tests/test_stmt.rs:108] &stmt = Ok(
    Semi(
        Verbatim(
            TokenStream [
                Ident {
                    sym: let,
                },
                Ident {
                    sym: Some,
                },
                Group {
                    delimiter: Parenthesis,
                    stream: TokenStream [
                        Ident {
                            sym: x,
                        },
                    ],
                },
                Punct {
                    char: '=',
                    spacing: Alone,
                },
                Ident {
                    sym: None,
                },
                Ident {
                    sym: else,
                },
                Group {
                    delimiter: Brace,
                    stream: TokenStream [
                        Ident {
                            sym: yield,
                        },
                        Literal {
                            lit: 1,
                        },
                        Punct {
                            char: ';',
                            spacing: Alone,
                        },
                    ],
                },
            ],
        ),
        Semi,
    ),
)

I'd like to contribute to it! But I'm not sure whether it will be accepted for an unstable feature

TennyZhuang avatar Apr 07 '22 23:04 TennyZhuang

It seems that we can add a new field else_branch: Box<Expr> in struct Local

TennyZhuang avatar Apr 07 '22 23:04 TennyZhuang

It looks reasonable. I think it is the right moment to do so, as let-else get into stable in next month (i.e. it is in beta now).

wkordalski avatar Oct 07 '22 09:10 wkordalski