aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-expr.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-05-23 10:46:59 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-05-23 13:49:01 +0100
commitcd39861da5e1113207193bb8b3e6fb3dde92895f (patch)
treeb12ed1fc0c7f4bcddbb38ff51cae7aea393b7a40 /gcc/rust/backend/rust-compile-expr.h
parentc7008d3e254786b5e752aa61e067f62c38042b81 (diff)
downloadgcc-cd39861da5e1113207193bb8b3e6fb3dde92895f.zip
gcc-cd39861da5e1113207193bb8b3e6fb3dde92895f.tar.gz
gcc-cd39861da5e1113207193bb8b3e6fb3dde92895f.tar.bz2
Fix Slice Type Layout
Slices in Rust are represented by TypePaths such as '[i32]'. Though if you actually try to use this explicit type-path you will hit errors such as this type has an unknown size at compile time. This is because this is actually what Rust calls a dynamically sized type. This means when you use types such as: '&[i32]' it is not actually a reference type to a slice. Its a slice in its entirety this means for lack of a better word when you use '*const [i32]' or '&mut [i32]' we end up actually passing around a struct by value _not_ at pointer/reference to it. This patch changes the type-layout so that we handle this layout change properly. This patch will also need to be applied to str types which I believe have a similar layout for safety. The patch also sets up TYPE_MAIN_VARIANT so that we can avoid unnessecary view_convert_expressions between *const [i32] and &mut [i32] which will have the same layout. Reference: https://doc.rust-lang.org/reference/dynamically-sized-types.html https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=672adac002939a2dab43b8d231adc1dc Fixes #1232
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.h')
0 files changed, 0 insertions, 0 deletions