aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2023-01-24 16:39:54 +0000
committerGitHub <noreply@github.com>2023-01-24 16:39:54 +0000
commit6a320bca7be0535b1e402ee48741df15c8e0aa8d (patch)
treedeb71fc1199717cd2e74adea098fd0d8c40b37ba /gcc/rust
parent7558c183a11db3f53275c2f4691e3575a6b014e4 (diff)
parentfc0c03dcf756c89694845484abd7d74ed080fdb6 (diff)
downloadgcc-6a320bca7be0535b1e402ee48741df15c8e0aa8d.zip
gcc-6a320bca7be0535b1e402ee48741df15c8e0aa8d.tar.gz
gcc-6a320bca7be0535b1e402ee48741df15c8e0aa8d.tar.bz2
Merge #1763
1763: Do not crash on empty macros expand. Fixes #1712 r=philberty a=teromene This PR fixes a compiler crash when expanding an empty macro into an existing AST. (I ran clang-format but it marked a few other files as dirty, and I therefore did not touch them) Signed-off-by: Lyra Karenai <teromene@teromene.fr> Co-authored-by: Lyra <teromene@teromene.fr>
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/expand/rust-macro-expand.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/rust/expand/rust-macro-expand.cc b/gcc/rust/expand/rust-macro-expand.cc
index 5894434..36b3195 100644
--- a/gcc/rust/expand/rust-macro-expand.cc
+++ b/gcc/rust/expand/rust-macro-expand.cc
@@ -839,6 +839,8 @@ static AST::Fragment
transcribe_expression (Parser<MacroInvocLexer> &parser)
{
auto expr = parser.parse_expr ();
+ if (expr == nullptr)
+ return AST::Fragment::create_error ();
return AST::Fragment::complete ({std::move (expr)});
}