aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/parse/rust-parse-impl.h
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2022-04-12 17:43:58 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2022-04-13 09:04:26 +0200
commit03cb435c1905e03da44a6a0723f03c38e7f59b09 (patch)
tree4ab923ef97fe1c6ecd8de49529adf33ae2004ce8 /gcc/rust/parse/rust-parse-impl.h
parent7430791e0f71f1882a0f856c496071b76c61a6bc (diff)
downloadgcc-03cb435c1905e03da44a6a0723f03c38e7f59b09.zip
gcc-03cb435c1905e03da44a6a0723f03c38e7f59b09.tar.gz
gcc-03cb435c1905e03da44a6a0723f03c38e7f59b09.tar.bz2
visibility: Add create_private() static function
When parsing a visibility in `parse_visibility`, it is not an error to not have a pub token: It simply means we want to create a private visibility. If we had C++14 or another language, we could instead represent all visibilities as an optional<AST::Visibility> where the Visibility class would not need to change. But I think the best course of action for our case is to instead keep visibilities even when they are private and have a special case in the `VisKind` enumeration.
Diffstat (limited to 'gcc/rust/parse/rust-parse-impl.h')
-rw-r--r--gcc/rust/parse/rust-parse-impl.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index 48c39de..d320f0b 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -2121,7 +2121,7 @@ Parser<ManagedTokenSource>::parse_visibility ()
// check for no visibility
if (lexer.peek_token ()->get_id () != PUB)
{
- return AST::Visibility::create_error ();
+ return AST::Visibility::create_private ();
}
lexer.skip_token ();