diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-01-25 13:27:50 +0000 |
---|---|---|
committer | Philip Herron <herron.philip@googlemail.com> | 2021-01-26 11:59:39 +0000 |
commit | 854aad3b58e747cad3e46b522c9ef765bdfadca4 (patch) | |
tree | e7c0943131d46cb1b9f2faaa4edfd6a5ede3c172 /gcc/rust/backend/rust-compile-context.h | |
parent | 0817c29a423aca1c4c3f9ba812f67df35f36fc65 (diff) | |
download | gcc-854aad3b58e747cad3e46b522c9ef765bdfadca4.zip gcc-854aad3b58e747cad3e46b522c9ef765bdfadca4.tar.gz gcc-854aad3b58e747cad3e46b522c9ef765bdfadca4.tar.bz2 |
Add usize and isize types
Arrays can only be indexed by usize and this enforces that rule. These
types are sized based on the pointer size of the host arch.
Fixes #87
Diffstat (limited to 'gcc/rust/backend/rust-compile-context.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-context.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h index ed03f02..034568f 100644 --- a/gcc/rust/backend/rust-compile-context.h +++ b/gcc/rust/backend/rust-compile-context.h @@ -374,6 +374,22 @@ public: translated = compiled_type; } + void visit (TyTy::USizeType &type) override + { + ::Btype *compiled_type = nullptr; + bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); + rust_assert (ok); + translated = compiled_type; + } + + void visit (TyTy::ISizeType &type) override + { + ::Btype *compiled_type = nullptr; + bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type); + rust_assert (ok); + translated = compiled_type; + } + private: TyTyResolveCompile (Context *ctx) : ctx (ctx) {} |