aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile.cc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-03-03 09:23:06 +0000
committerPhilip Herron <philip.herron@embecosm.com>2022-03-03 11:08:18 +0000
commitd6e1771291c792f665f5b9ed7d065bf292051e6a (patch)
treed26c37ac592965fdb52caa73c41cd6e95ae322c8 /gcc/rust/backend/rust-compile.cc
parent57b50607988481238275d8a2f73722896cbe0fe2 (diff)
downloadgcc-d6e1771291c792f665f5b9ed7d065bf292051e6a.zip
gcc-d6e1771291c792f665f5b9ed7d065bf292051e6a.tar.gz
gcc-d6e1771291c792f665f5b9ed7d065bf292051e6a.tar.bz2
must use attribute support
This ports over the code from the cpp front-end which implements the cpp nodiscard attribute which has the same behaviour and is also implemented in the front-end explicitly. Fixes #856
Diffstat (limited to 'gcc/rust/backend/rust-compile.cc')
-rw-r--r--gcc/rust/backend/rust-compile.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc
index 6aec050..9e2c5b3 100644
--- a/gcc/rust/backend/rust-compile.cc
+++ b/gcc/rust/backend/rust-compile.cc
@@ -82,7 +82,8 @@ CompileBlock::visit (HIR::BlockExpr &expr)
auto compiled_expr = CompileStmt::Compile (s.get (), ctx);
if (compiled_expr != nullptr)
{
- ctx->add_statement (compiled_expr);
+ tree s = convert_to_void (compiled_expr, ICV_STATEMENT);
+ ctx->add_statement (s);
}
}