public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] gccrs: Remove cmp_autoderef_mode hack from old autoderef
@ 2023-02-28 22:37 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2023-02-28 22:37 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:41890d20e27d9be91fe5b35d5c85fb6a4ddcd2dd

commit 41890d20e27d9be91fe5b35d5c85fb6a4ddcd2dd
Author: Philip Herron <herron.philip@googlemail.com>
Date:   Tue Feb 28 19:07:11 2023 +0000

    gccrs: Remove cmp_autoderef_mode hack from old autoderef
    
    Signed-off-by: Philip Herron <herron.philip@googlemail.com>
    
    gcc/rust/ChangeLog:
    
            * typecheck/rust-tyty-cmp.h: remove
            * typecheck/rust-tyty.cc (set_cmp_autoderef_mode): likewise
            (reset_cmp_autoderef_mode): likewise
            * typecheck/rust-tyty.h (set_cmp_autoderef_mode): likewise
            (reset_cmp_autoderef_mode): likewise

Diff:
---
 gcc/rust/typecheck/rust-tyty-cmp.h | 12 +-----------
 gcc/rust/typecheck/rust-tyty.cc    | 13 -------------
 gcc/rust/typecheck/rust-tyty.h     |  5 -----
 3 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/gcc/rust/typecheck/rust-tyty-cmp.h b/gcc/rust/typecheck/rust-tyty-cmp.h
index 293c8bfa641..9006eb1b954 100644
--- a/gcc/rust/typecheck/rust-tyty-cmp.h
+++ b/gcc/rust/typecheck/rust-tyty-cmp.h
@@ -28,10 +28,6 @@
 namespace Rust {
 namespace TyTy {
 
-// we need to fix this properly by implementing the match for assembling
-// candidates
-extern bool autoderef_cmp_flag;
-
 class BaseCmp : public TyConstVisitor
 {
 public:
@@ -1271,9 +1267,6 @@ public:
     auto other_base_type = type.get_base ();
 
     bool mutability_ok = base->is_mutable () ? type.is_mutable () : true;
-    if (autoderef_cmp_flag)
-      mutability_ok = base->mutability () == type.mutability ();
-
     if (!mutability_ok)
       {
 	BaseCmp::visit (type);
@@ -1320,9 +1313,6 @@ public:
     auto other_base_type = type.get_base ();
 
     bool mutability_ok = base->is_mutable () ? type.is_mutable () : true;
-    if (autoderef_cmp_flag)
-      mutability_ok = base->mutability () == type.mutability ();
-
     if (!mutability_ok)
       {
 	BaseCmp::visit (type);
@@ -1401,7 +1391,7 @@ public:
 
   void visit (const ArrayType &) override { ok = true; }
 
-  void visit (const SliceType &) override { ok = !autoderef_cmp_flag; }
+  void visit (const SliceType &) override { ok = true; }
 
   void visit (const BoolType &) override { ok = true; }
 
diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc
index 28d03ce52c5..110f59266f3 100644
--- a/gcc/rust/typecheck/rust-tyty.cc
+++ b/gcc/rust/typecheck/rust-tyty.cc
@@ -38,19 +38,6 @@
 namespace Rust {
 namespace TyTy {
 
-bool autoderef_cmp_flag = false;
-
-void
-set_cmp_autoderef_mode ()
-{
-  autoderef_cmp_flag = true;
-}
-void
-reset_cmp_autoderef_mode ()
-{
-  autoderef_cmp_flag = false;
-}
-
 std::string
 TypeKindFormat::to_string (TypeKind kind)
 {
diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h
index 05cd3a78dd8..b729437f73d 100644
--- a/gcc/rust/typecheck/rust-tyty.h
+++ b/gcc/rust/typecheck/rust-tyty.h
@@ -77,11 +77,6 @@ public:
   static std::string to_string (TypeKind kind);
 };
 
-extern void
-set_cmp_autoderef_mode ();
-extern void
-reset_cmp_autoderef_mode ();
-
 class TyVisitor;
 class TyConstVisitor;
 class BaseType : public TypeBoundsMappings

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

only message in thread, other threads:[~2023-02-28 22:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-28 22:37 [gcc/devel/rust/master] gccrs: Remove cmp_autoderef_mode hack from old autoderef 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).