#include "rust-hir-trait-resolve.h"
#include "rust-substitution-mapper.h"
#include "rust-type-util.h"
+#include "rust-tyty-variance-analysis.h"
namespace Rust {
namespace Resolver {
TyTy::ADTType::ReprOptions repr
= parse_repr_options (attrs, struct_decl.get_locus ());
- TyTy::BaseType *type = new TyTy::ADTType (
+ auto *type = new TyTy::ADTType (
struct_decl.get_mappings ().get_hirid (), mappings->get_next_hir_id (),
struct_decl.get_identifier ().as_string (), ident,
TyTy::ADTType::ADTKind::TUPLE_STRUCT, std::move (variants),
context->insert_type (struct_decl.get_mappings (), type);
infered = type;
+
+ context->get_variance_analysis_ctx ().add_type_constraints (*type);
}
void
TyTy::ADTType::ReprOptions repr
= parse_repr_options (attrs, struct_decl.get_locus ());
- TyTy::BaseType *type = new TyTy::ADTType (
+ auto *type = new TyTy::ADTType (
struct_decl.get_mappings ().get_hirid (), mappings->get_next_hir_id (),
struct_decl.get_identifier ().as_string (), ident,
TyTy::ADTType::ADTKind::STRUCT_STRUCT, std::move (variants),
context->insert_type (struct_decl.get_mappings (), type);
infered = type;
+
+ context->get_variance_analysis_ctx ().add_type_constraints (*type);
}
void
RustIdent ident{*canonical_path, enum_decl.get_locus ()};
// multi variant ADT
- TyTy::BaseType *type
+ auto *type
= new TyTy::ADTType (enum_decl.get_mappings ().get_hirid (),
mappings->get_next_hir_id (),
enum_decl.get_identifier ().as_string (), ident,
context->insert_type (enum_decl.get_mappings (), type);
infered = type;
+
+ context->get_variance_analysis_ctx ().add_type_constraints (*type);
}
void
TyTy::VariantDef::VariantType::STRUCT, nullptr,
std::move (fields)));
- TyTy::BaseType *type
+ auto *type
= new TyTy::ADTType (union_decl.get_mappings ().get_hirid (),
mappings->get_next_hir_id (),
union_decl.get_identifier ().as_string (), ident,
context->insert_type (union_decl.get_mappings (), type);
infered = type;
+
+ context->get_variance_analysis_ctx ().add_type_constraints (*type);
}
void