aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/parse/rust-parse-impl.h
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-04-13 10:41:12 +0000
committerGitHub <noreply@github.com>2022-04-13 10:41:12 +0000
commit497ee70b776574aa3559c7d49a5cc7cf359d320e (patch)
treec370014a4fa91bde13742e1f459accb3d72c69ae /gcc/rust/parse/rust-parse-impl.h
parentc1639be8bb0bd19810c7dc3040ad224dd864f699 (diff)
parent03cb435c1905e03da44a6a0723f03c38e7f59b09 (diff)
downloadgcc-497ee70b776574aa3559c7d49a5cc7cf359d320e.zip
gcc-497ee70b776574aa3559c7d49a5cc7cf359d320e.tar.gz
gcc-497ee70b776574aa3559c7d49a5cc7cf359d320e.tar.bz2
Merge #1111
1111: Add AST Private Visibilities r=CohenArthur a=CohenArthur 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. This also enables HIR lowering of visibilities to be performed properly for private items Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
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 e352836..c95afd6 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 ();