public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Merge #873
@ 2022-06-08 12:01 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:01 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:2cce6b8919ce16acd37a7a203049a52925a7e295

commit 2cce6b8919ce16acd37a7a203049a52925a7e295
Merge: 6c9e57efa54 ee794effe3b
Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com>
Date:   Sat Jan 22 13:07:05 2022 +0000

    Merge #873
    
    873: Method resolution should respect deref lang-items r=philberty a=philberty
    
    Method resolution in rust must respect the autoderef cycle by calling into the deref lang items as required. This
    allows for method resolution behind boxing for example. See below for an example gimple dump of two levels
    of deref operator overloads. The commit message ee794effe3b55d2aa8acc108fb36bd8d05672dfa holds much
    more detail on the changes in this patch.
    
    ```
    void main ()
    {
      const struct  bar;
      const struct  foo;
      const i32 foobar;
      try
        {
          bar.0 = 123;
          foo.0 = &bar;
          RUSTTMP.3 = <Foo as Deref>::deref<&Bar> (&foo);
          RUSTTMP.5 = <&T as Deref>::deref<Bar> (RUSTTMP.3);
          foobar = Bar::foobar (*RUSTTMP.5);
        }
      finally
        {
          bar = {CLOBBER};
          foo = {CLOBBER};
        }
    }
    ```
    
    Fixes #884
    
    Co-authored-by: Philip Herron <philip.herron@embecosm.com>

Diff:

 gcc/rust/Make-lang.in                              |   1 +
 gcc/rust/backend/rust-compile-base.h               |  11 +
 gcc/rust/backend/rust-compile-expr.cc              | 249 ++++++---------
 gcc/rust/backend/rust-compile-implitem.h           |  16 +-
 gcc/rust/backend/rust-compile-item.h               |   3 +-
 gcc/rust/backend/rust-compile-resolve-path.cc      |  22 +-
 gcc/rust/backend/rust-compile-resolve-path.h       |   5 -
 gcc/rust/backend/rust-compile-var-decl.h           |   1 +
 gcc/rust/backend/rust-compile.cc                   |   5 +-
 gcc/rust/typecheck/rust-autoderef.cc               | 242 ++++++++++++++
 gcc/rust/typecheck/rust-autoderef.h                |  98 +++---
 gcc/rust/typecheck/rust-hir-dot-operator.h         | 349 +++++++++++++++------
 .../typecheck/rust-hir-inherent-impl-overlap.h     |   2 +-
 gcc/rust/typecheck/rust-hir-path-probe.h           |  18 +-
 gcc/rust/typecheck/rust-hir-trait-ref.h            |  26 +-
 gcc/rust/typecheck/rust-hir-type-check-expr.h      | 152 +++------
 gcc/rust/typecheck/rust-hir-type-check-implitem.h  |  59 ++--
 gcc/rust/typecheck/rust-hir-type-check-item.h      |  10 +-
 gcc/rust/typecheck/rust-hir-type-check.h           |   2 +-
 gcc/rust/typecheck/rust-tyty-bounds.cc             |   2 +-
 gcc/rust/typecheck/rust-tyty-cmp.h                 | 145 ++++-----
 gcc/rust/typecheck/rust-tyty-rules.h               |   3 -
 gcc/rust/typecheck/rust-tyty.cc                    | 123 +++-----
 gcc/rust/typecheck/rust-tyty.h                     |  72 ++---
 gcc/testsuite/rust/execute/torture/method2.rs      |  76 +++++
 25 files changed, 1002 insertions(+), 690 deletions(-)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-08 12:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:01 [gcc/devel/rust/master] Merge #873 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).