]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Ensure TupleStructPattern and TuplePattern have items
authorOwen Avery <powerboat9.gamer@gmail.com>
Tue, 27 Feb 2024 21:34:23 +0000 (16:34 -0500)
committerArthur Cohen <arthur.cohen@embecosm.com>
Thu, 1 Aug 2024 11:12:14 +0000 (13:12 +0200)
commitebbf7bedbabc2a52fd0cd2b97611eb5d9bf02086
treebe426b6c1bfaf532d8eec343f3fa2a9c3daca93a
parent38aa479b0333b66057553635952cadeafb6c89d1
gccrs: 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