aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-07-19 17:12:15 +0100
committerPhilip Herron <philip.herron@embecosm.com>2021-07-19 19:36:39 +0100
commit2f7b803bcca98df8cba21c7107d777e8749a88cd (patch)
tree671bd3aff1b89c63b4266fc97970779523470f20 /gcc
parenteea221e39ead0f45e9ef91aaf1b5ed855a4a5d8b (diff)
downloadgcc-2f7b803bcca98df8cba21c7107d777e8749a88cd.zip
gcc-2f7b803bcca98df8cba21c7107d777e8749a88cd.tar.gz
gcc-2f7b803bcca98df8cba21c7107d777e8749a88cd.tar.bz2
Refs should be used in the base ctor of BaseType
Refs refers to the reference chain used in the type checking resolution of this type. We use to eagerly replace the Inference Vars when they unify or are coerced or default. Fixes #352
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/typecheck/rust-tyty.h90
1 files changed, 20 insertions, 70 deletions
diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h
index 935b943..7f0ad35 100644
--- a/gcc/rust/typecheck/rust-tyty.h
+++ b/gcc/rust/typecheck/rust-tyty.h
@@ -1293,22 +1293,12 @@ class USizeType : public BaseType
{
public:
USizeType (HirId ref, std::set<HirId> refs = std::set<HirId> ())
- : BaseType (ref, ref, TypeKind::USIZE)
- {
- // TODO unused; should 'refs' be passed as the last argument to the
- // 'BaseType' constructor call? Potential change in behavior (if 'refs' is
- // provided by caller)?
- (void) refs;
- }
+ : BaseType (ref, ref, TypeKind::USIZE, refs)
+ {}
USizeType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ())
- : BaseType (ref, ty_ref, TypeKind::USIZE)
- {
- // TODO unused; should 'refs' be passed as the last argument to the
- // 'BaseType' constructor call? Potential change in behavior (if 'refs' is
- // provided by caller)?
- (void) refs;
- }
+ : BaseType (ref, ty_ref, TypeKind::USIZE, refs)
+ {}
void accept_vis (TyVisitor &vis) override;
void accept_vis (TyConstVisitor &vis) const override;
@@ -1327,22 +1317,12 @@ class ISizeType : public BaseType
{
public:
ISizeType (HirId ref, std::set<HirId> refs = std::set<HirId> ())
- : BaseType (ref, ref, TypeKind::ISIZE)
- {
- // TODO unused; should 'refs' be passed as the last argument to the
- // 'BaseType' constructor call? Potential change in behavior (if 'refs' is
- // provided by caller)?
- (void) refs;
- }
+ : BaseType (ref, ref, TypeKind::ISIZE, refs)
+ {}
ISizeType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ())
- : BaseType (ref, ty_ref, TypeKind::ISIZE)
- {
- // TODO unused; should 'refs' be passed as the last argument to the
- // 'BaseType' constructor call? Potential change in behavior (if 'refs' is
- // provided by caller)?
- (void) refs;
- }
+ : BaseType (ref, ty_ref, TypeKind::ISIZE, refs)
+ {}
void accept_vis (TyVisitor &vis) override;
void accept_vis (TyConstVisitor &vis) const override;
@@ -1361,22 +1341,12 @@ class CharType : public BaseType
{
public:
CharType (HirId ref, std::set<HirId> refs = std::set<HirId> ())
- : BaseType (ref, ref, TypeKind::CHAR)
- {
- // TODO unused; should 'refs' be passed as the last argument to the
- // 'BaseType' constructor call? Potential change in behavior (if 'refs' is
- // provided by caller)?
- (void) refs;
- }
+ : BaseType (ref, ref, TypeKind::CHAR, refs)
+ {}
CharType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ())
- : BaseType (ref, ty_ref, TypeKind::CHAR)
- {
- // TODO unused; should 'refs' be passed as the last argument to the
- // 'BaseType' constructor call? Potential change in behavior (if 'refs' is
- // provided by caller)?
- (void) refs;
- }
+ : BaseType (ref, ty_ref, TypeKind::CHAR, refs)
+ {}
void accept_vis (TyVisitor &vis) override;
void accept_vis (TyConstVisitor &vis) const override;
@@ -1396,23 +1366,13 @@ class ReferenceType : public BaseType
public:
ReferenceType (HirId ref, TyVar base,
std::set<HirId> refs = std::set<HirId> ())
- : BaseType (ref, ref, TypeKind::REF), base (base)
- {
- // TODO unused; should 'refs' be passed as the last argument to the
- // 'BaseType' constructor call? Potential change in behavior (if 'refs' is
- // provided by caller)?
- (void) refs;
- }
+ : BaseType (ref, ref, TypeKind::REF, refs), base (base)
+ {}
ReferenceType (HirId ref, HirId ty_ref, TyVar base,
std::set<HirId> refs = std::set<HirId> ())
- : BaseType (ref, ty_ref, TypeKind::REF), base (base)
- {
- // TODO unused; should 'refs' be passed as the last argument to the
- // 'BaseType' constructor call? Potential change in behavior (if 'refs' is
- // provided by caller)?
- (void) refs;
- }
+ : BaseType (ref, ty_ref, TypeKind::REF, refs), base (base)
+ {}
BaseType *get_base () const;
@@ -1445,22 +1405,12 @@ class StrType : public BaseType
{
public:
StrType (HirId ref, std::set<HirId> refs = std::set<HirId> ())
- : BaseType (ref, ref, TypeKind::STR)
- {
- // TODO unused; should 'refs' be passed as the last argument to the
- // 'BaseType' constructor call? Potential change in behavior (if 'refs' is
- // provided by caller)?
- (void) refs;
- }
+ : BaseType (ref, ref, TypeKind::STR, refs)
+ {}
StrType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ())
- : BaseType (ref, ty_ref, TypeKind::STR)
- {
- // TODO unused; should 'refs' be passed as the last argument to the
- // 'BaseType' constructor call? Potential change in behavior (if 'refs' is
- // provided by caller)?
- (void) refs;
- }
+ : BaseType (ref, ty_ref, TypeKind::STR, refs)
+ {}
std::string get_name () const override final { return as_string (); }