Skip to content

Commit 8c2fac6

Browse files
committed
Use tl::expected for parse_block_expr results
gcc/rust/ChangeLog: * parse/rust-parse-error.h (struct BlockExpr): Add BlockExpr error type * parse/rust-parse-impl-expr.hxx: Update return types. * parse/rust-parse-impl.hxx: Likewise. * parse/rust-parse.h: Update function prototypes. Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
1 parent c599752 commit 8c2fac6

File tree

4 files changed

+111
-72
lines changed

4 files changed

+111
-72
lines changed

gcc/rust/parse/rust-parse-error.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,23 @@ struct Self
385385
Self (Kind kind) : kind (kind) {}
386386
};
387387

388+
struct BlockExpr
389+
{
390+
static tl::expected<std::unique_ptr<AST::BlockExpr>, BlockExpr>
391+
make_malformed ()
392+
{
393+
return tl::unexpected<BlockExpr> (BlockExpr (Kind::MALFORMED));
394+
}
395+
396+
enum class Kind
397+
{
398+
MALFORMED,
399+
} kind;
400+
401+
private:
402+
BlockExpr (Kind kind) : kind (kind) {}
403+
};
404+
388405
} // namespace Error
389406
} // namespace Parse
390407
} // namespace Rust

0 commit comments

Comments
 (0)