public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Merge #818
@ 2022-06-08 11:55 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 11:55 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:0024bc2f028369b871a65ceb11b2fddfb0f9c3aa
commit 0024bc2f028369b871a65ceb11b2fddfb0f9c3aa
Merge: 3b8cbff816c c7af812802f
Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com>
Date: Fri Nov 26 09:19:08 2021 +0000
Merge #818
818: Deref operator overloading r=philberty a=philberty
This adds initial support for dereferencing operator overloading. We need to be able
to use this as part of the autoderef cycle next.
It has two default impl's one for '&T' and '&mut T' to apply genericly.
The reason it is interesting is from the prototype the deref lang item
always returns &Self::Target in all cases regardless of mutability, the
lang item here is designed to wrap up any dereference such that when
applied it guarentees the type system you will get back an immutable
reference to something. The reason for doing this is more clear when
thinking about autoderef and method-resolution and how you apply
dereference operations to custom types and a test case is included for
that.
Fixes #809
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diff:
gcc/rust/backend/rust-compile-expr.cc | 37 ++++++++++
gcc/rust/backend/rust-compile-expr.h | 21 +-----
gcc/rust/typecheck/rust-hir-type-check-expr.h | 33 ++++++++-
gcc/rust/util/rust-hir-map.h | 8 +++
.../rust/execute/torture/operator_overload_10.rs | 79 ++++++++++++++++++++++
.../rust/execute/torture/operator_overload_7.rs | 44 ++++++++++++
.../rust/execute/torture/operator_overload_8.rs | 61 +++++++++++++++++
.../rust/execute/torture/operator_overload_9.rs | 61 +++++++++++++++++
8 files changed, 321 insertions(+), 23 deletions(-)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-08 11:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 11:55 [gcc/devel/rust/master] Merge #818 Thomas Schwinge
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).