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/resolve | |
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/resolve')
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve.cc b/gcc/rust/resolve/rust-ast-resolve.cc index ec53ae0..c6d7148 100644 --- a/gcc/rust/resolve/rust-ast-resolve.cc +++ b/gcc/rust/resolve/rust-ast-resolve.cc @@ -146,6 +146,8 @@ Resolver::generate_builtins () = new TyTy::FloatType (mappings->get_next_hir_id (), TyTy::FloatType::F32); auto f64 = new TyTy::FloatType (mappings->get_next_hir_id (), TyTy::FloatType::F64); + auto usize = new TyTy::USizeType (mappings->get_next_hir_id ()); + auto isize = new TyTy::ISizeType (mappings->get_next_hir_id ()); MKBUILTIN_TYPE ("u8", builtins, u8); MKBUILTIN_TYPE ("u16", builtins, u16); @@ -160,6 +162,8 @@ Resolver::generate_builtins () MKBUILTIN_TYPE ("bool", builtins, rbool); MKBUILTIN_TYPE ("f32", builtins, f32); MKBUILTIN_TYPE ("f64", builtins, f64); + MKBUILTIN_TYPE ("usize", builtins, usize); + MKBUILTIN_TYPE ("isize", builtins, isize); // unit type () TyTy::UnitType *unit_tyty = new TyTy::UnitType (mappings->get_next_hir_id ()); |