aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve/rust-early-name-resolver.cc
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2024-02-27 16:34:23 -0500
committerCohenArthur <arthur.cohen@embecosm.com>2024-03-04 11:22:29 +0000
commitdae69e86c0feafd4e67bec2309c8e14b82f935ac (patch)
treec19c10d15ccd16767d4048ba4877df8a64a2253c /gcc/rust/resolve/rust-early-name-resolver.cc
parentede65c2801c05b3c60f13b1f7fb434567fb97447 (diff)
downloadgcc-dae69e86c0feafd4e67bec2309c8e14b82f935ac.zip
gcc-dae69e86c0feafd4e67bec2309c8e14b82f935ac.tar.gz
gcc-dae69e86c0feafd4e67bec2309c8e14b82f935ac.tar.bz2
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>
Diffstat (limited to 'gcc/rust/resolve/rust-early-name-resolver.cc')
-rw-r--r--gcc/rust/resolve/rust-early-name-resolver.cc10
1 files changed, 0 insertions, 10 deletions
diff --git a/gcc/rust/resolve/rust-early-name-resolver.cc b/gcc/rust/resolve/rust-early-name-resolver.cc
index d70f9ca..5447084 100644
--- a/gcc/rust/resolve/rust-early-name-resolver.cc
+++ b/gcc/rust/resolve/rust-early-name-resolver.cc
@@ -558,16 +558,6 @@ EarlyNameResolver::visit (AST::StructPattern &)
void
EarlyNameResolver::visit (AST::TupleStructPattern &pattern)
{
- if (!pattern.has_items ())
- {
- rich_location rich_locus (line_table, pattern.get_locus ());
- rich_locus.add_fixit_replace (
- "function calls are not allowed in patterns");
- rust_error_at (
- rich_locus, ErrorCode::E0164,
- "expected tuple struct or tuple variant, found associated function");
- return;
- }
pattern.get_items ()->accept_vis (*this);
}