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] Add testcase to prove bug is fixed Date: Wed, 8 Jun 2022 12:50:24 +0000 (GMT) [thread overview] Message-ID: <20220608125024.BB5D7388B5A4@sourceware.org> (raw) https://gcc.gnu.org/g:3a95f28788d6a7b1870f6247c5fa1e5af1ff8a61 commit 3a95f28788d6a7b1870f6247c5fa1e5af1ff8a61 Author: Philip Herron <philip.herron@embecosm.com> Date: Wed May 25 15:01:52 2022 +0100 Add testcase to prove bug is fixed This bug was fixed in commit cb4d935508def8b250345ba5205a90ad9e177ab4 with related PR #1223 The issue is that associated tpyes get updated depending on the context they are used so we need to monomorphize the types when we can so that we don't then throw off the rest of typechecking with bogus errors like this. Fixes #1237 Diff: --- gcc/testsuite/rust/compile/issue-1237.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/gcc/testsuite/rust/compile/issue-1237.rs b/gcc/testsuite/rust/compile/issue-1237.rs new file mode 100644 index 00000000000..542be897949 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-1237.rs @@ -0,0 +1,23 @@ +// { dg-additional-options "-w" } +mod intrinsics { + extern "rust-intrinsic" { + pub fn offset<T>(ptr: *const T, count: isize) -> *const T; + } +} + +impl<T> *const T { + pub unsafe fn offset(self, count: isize) -> *const T { + unsafe { intrinsics::offset(self, count) } + } +} + +impl<T> [T] { + pub unsafe fn get_unchecked(&self, index: usize) -> &T { + unsafe { &*(self as *const [T] as *const T).offset(index as isize) } + } +} + +#[inline] +unsafe fn u8to64_le(buf: &[u8], start: usize, len: usize) -> u64 { + (unsafe { *buf.get_unchecked(start) } as u64) +}
reply other threads:[~2022-06-08 12:50 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=20220608125024.BB5D7388B5A4@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).