aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-item.h
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-07-27 13:36:51 +0000
committerGitHub <noreply@github.com>2021-07-27 13:36:51 +0000
commitf76ddb42f82c04baf6b14aef1b532ccb5a0425bb (patch)
tree5b2ddeb0e2c1839ff97d7aa78886345295ef607a /gcc/rust/backend/rust-compile-item.h
parent9526e6d62167ff824814c7ac8c09b36316029262 (diff)
parent7f8adccb5056152edc4aacf08ce2ed040f076171 (diff)
downloadgcc-f76ddb42f82c04baf6b14aef1b532ccb5a0425bb.zip
gcc-f76ddb42f82c04baf6b14aef1b532ccb5a0425bb.tar.gz
gcc-f76ddb42f82c04baf6b14aef1b532ccb5a0425bb.tar.bz2
Merge #598
598: Hello world r=philberty a=philberty ```rust extern "C" { fn puts(s: *const i8); } fn main() { unsafe { let a = "Hello World\0"; let b = a as *const str; let c = b as *const i8; puts(c); } } ``` Fixes #421 Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/backend/rust-compile-item.h')
-rw-r--r--gcc/rust/backend/rust-compile-item.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-item.h b/gcc/rust/backend/rust-compile-item.h
index eacfda9..a6bc7f3 100644
--- a/gcc/rust/backend/rust-compile-item.h
+++ b/gcc/rust/backend/rust-compile-item.h
@@ -26,6 +26,7 @@
#include "rust-compile-stmt.h"
#include "rust-compile-expr.h"
#include "rust-compile-fnparam.h"
+#include "rust-compile-extern.h"
namespace Rust {
namespace Compile {
@@ -274,6 +275,14 @@ public:
compile_fns);
}
+ void visit (HIR::ExternBlock &extern_block) override
+ {
+ for (auto &item : extern_block.get_extern_items ())
+ {
+ CompileExternItem::compile (item.get (), ctx, compile_fns, concrete);
+ }
+ }
+
private:
CompileItem (Context *ctx, bool compile_fns, TyTy::BaseType *concrete)
: HIRCompileBase (ctx), compile_fns (compile_fns), concrete (concrete)