]> git.ipfire.org Git - thirdparty/gcc.git/commit
Ensure TupleStructPattern and TuplePattern have items
authorOwen Avery <powerboat9.gamer@gmail.com>
Tue, 27 Feb 2024 21:34:23 +0000 (16:34 -0500)
committerCohenArthur <arthur.cohen@embecosm.com>
Mon, 4 Mar 2024 11:22:29 +0000 (11:22 +0000)
commitdae69e86c0feafd4e67bec2309c8e14b82f935ac
treec19c10d15ccd16767d4048ba4877df8a64a2253c
parentede65c2801c05b3c60f13b1f7fb434567fb97447
Ensure TupleStructPattern and TuplePattern have items

Note that instances of both classes which have been
moved from will have (items == nullptr).

gcc/rust/ChangeLog:

* ast/rust-pattern.h
(class TupleStructPattern): Assert that items != nullptr.
(class TuplePattern): Likewise.
(TupleStructPattern::has_items): Remove.
(TuplePattern::has_tuple_pattern_items): Likewise.
* parse/rust-parse-impl.h
(Parser::parse_ident_leading_pattern):
Prevent construction of TupleStructPattern with
(items == nullptr).
(Parser::parse_pattern_no_alt): Likewise.
* ast/rust-ast-collector.cc
(TokenCollector::visit): Remove usage of
TupleStructPattern::has_items.
* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit): Likewise.
* resolve/rust-early-name-resolver.cc
(EarlyNameResolver::visit): Likewise.

gcc/testsuite/ChangeLog:

* rust/compile/pattern-struct.rs: Fix test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/ast/rust-ast-collector.cc
gcc/rust/ast/rust-ast-visitor.cc
gcc/rust/ast/rust-pattern.h
gcc/rust/parse/rust-parse-impl.h
gcc/rust/resolve/rust-early-name-resolver.cc
gcc/testsuite/rust/compile/pattern-struct.rs