Skip to content

Commit 41890d2

Browse files
committed
gccrs: Remove cmp_autoderef_mode hack from old autoderef
Signed-off-by: Philip Herron <[email protected]> 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
1 parent 43a9278 commit 41890d2

File tree

3 files changed

+1
-29
lines changed

3 files changed

+1
-29
lines changed

gcc/rust/typecheck/rust-tyty-cmp.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@
2828
namespace Rust {
2929
namespace TyTy {
3030

31-
// we need to fix this properly by implementing the match for assembling
32-
// candidates
33-
extern bool autoderef_cmp_flag;
34-
3531
class BaseCmp : public TyConstVisitor
3632
{
3733
public:
@@ -1271,9 +1267,6 @@ class ReferenceCmp : public BaseCmp
12711267
auto other_base_type = type.get_base ();
12721268

12731269
bool mutability_ok = base->is_mutable () ? type.is_mutable () : true;
1274-
if (autoderef_cmp_flag)
1275-
mutability_ok = base->mutability () == type.mutability ();
1276-
12771270
if (!mutability_ok)
12781271
{
12791272
BaseCmp::visit (type);
@@ -1320,9 +1313,6 @@ class PointerCmp : public BaseCmp
13201313
auto other_base_type = type.get_base ();
13211314

13221315
bool mutability_ok = base->is_mutable () ? type.is_mutable () : true;
1323-
if (autoderef_cmp_flag)
1324-
mutability_ok = base->mutability () == type.mutability ();
1325-
13261316
if (!mutability_ok)
13271317
{
13281318
BaseCmp::visit (type);
@@ -1401,7 +1391,7 @@ class ParamCmp : public BaseCmp
14011391

14021392
void visit (const ArrayType &) override { ok = true; }
14031393

1404-
void visit (const SliceType &) override { ok = !autoderef_cmp_flag; }
1394+
void visit (const SliceType &) override { ok = true; }
14051395

14061396
void visit (const BoolType &) override { ok = true; }
14071397

gcc/rust/typecheck/rust-tyty.cc

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,6 @@
3838
namespace Rust {
3939
namespace TyTy {
4040

41-
bool autoderef_cmp_flag = false;
42-
43-
void
44-
set_cmp_autoderef_mode ()
45-
{
46-
autoderef_cmp_flag = true;
47-
}
48-
void
49-
reset_cmp_autoderef_mode ()
50-
{
51-
autoderef_cmp_flag = false;
52-
}
53-
5441
std::string
5542
TypeKindFormat::to_string (TypeKind kind)
5643
{

gcc/rust/typecheck/rust-tyty.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ class TypeKindFormat
7777
static std::string to_string (TypeKind kind);
7878
};
7979

80-
extern void
81-
set_cmp_autoderef_mode ();
82-
extern void
83-
reset_cmp_autoderef_mode ();
84-
8580
class TyVisitor;
8681
class TyConstVisitor;
8782
class BaseType : public TypeBoundsMappings

0 commit comments

Comments
 (0)