diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-07-20 08:17:09 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-20 08:17:09 +0000 |
commit | 02713d245aaffd45d8daaf8c914b1dda5baa6eb4 (patch) | |
tree | c9119796d4330f6dda5d93f85de80044de723cb4 /gcc/rust/backend | |
parent | eea221e39ead0f45e9ef91aaf1b5ed855a4a5d8b (diff) | |
parent | f56781662f82dcbe1780cbe3e7eb4ac17f8156d0 (diff) | |
download | gcc-02713d245aaffd45d8daaf8c914b1dda5baa6eb4.zip gcc-02713d245aaffd45d8daaf8c914b1dda5baa6eb4.tar.gz gcc-02713d245aaffd45d8daaf8c914b1dda5baa6eb4.tar.bz2 |
Merge #577
577: Initial type coercion code r=philberty a=philberty
This is the initial type coercion code. Coercions are necessary to implement
mutability on reference types and for raw pointers in general.
Fixes #576 #352
Addresses #434
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r-- | gcc/rust/backend/rust-compile-context.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h index d822937..efca267 100644 --- a/gcc/rust/backend/rust-compile-context.h +++ b/gcc/rust/backend/rust-compile-context.h @@ -537,6 +537,10 @@ public: Btype *base_compiled_type = TyTyResolveCompile::compile (ctx, type.get_base ()); translated = ctx->get_backend ()->reference_type (base_compiled_type); + if (!type.is_mutable ()) + { + translated = ctx->get_backend ()->immutable_type (translated); + } } void visit (TyTy::StrType &type) override |