public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] Merge #1268 Date: Wed, 8 Jun 2022 12:49:23 +0000 (GMT) [thread overview] Message-ID: <20220608124923.C2CC83810AFF@sourceware.org> (raw) https://gcc.gnu.org/g:bf6d540b1043bb944450dfe9da4c91124cdf31d3 commit bf6d540b1043bb944450dfe9da4c91124cdf31d3 Merge: 63762cc243c cd39861da5e Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com> Date: Mon May 23 14:57:55 2022 +0000 Merge #1268 1268: Fix Slice Type Layout r=philberty a=philberty 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 Co-authored-by: Philip Herron <philip.herron@embecosm.com> Diff: gcc/rust/backend/rust-compile-context.h | 12 ++ gcc/rust/backend/rust-compile-expr.cc | 56 +++++++- gcc/rust/backend/rust-compile-type.cc | 82 +++++++++--- gcc/rust/backend/rust-compile-type.h | 8 +- gcc/rust/backend/rust-compile.cc | 19 +++ gcc/rust/backend/rust-tree.h | 6 + gcc/rust/typecheck/rust-tyty.h | 30 +++++ gcc/testsuite/rust/execute/torture/issue-1232.rs | 159 +++++++++++++++++++++++ 8 files changed, 345 insertions(+), 27 deletions(-)
reply other threads:[~2022-06-08 12:49 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220608124923.C2CC83810AFF@sourceware.org \ --to=tschwinge@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).