diff --git a/gcc/rust/ast/rust-macro.h b/gcc/rust/ast/rust-macro.h index bcf5b0b5a994..024facf9ea22 100644 --- a/gcc/rust/ast/rust-macro.h +++ b/gcc/rust/ast/rust-macro.h @@ -459,6 +459,8 @@ class MacroRulesDefinition : public VisItem DeclMacro, }; + MacroRulesDefinition (const MacroRulesDefinition &other) = default; + private: std::vector outer_attrs; Identifier rule_name; @@ -602,6 +604,18 @@ class MacroInvocation : public TypeNoBounds, public ExprWithoutBlock { public: + MacroInvocation (const MacroInvocation &other) + : TraitItem (other.locus), outer_attrs (other.outer_attrs), + locus (other.locus), node_id (other.node_id), + invoc_data (other.invoc_data), is_semi_coloned (other.is_semi_coloned), + kind (other.kind), builtin_kind (other.builtin_kind) + { + if (other.kind == InvocKind::Builtin) + for (auto &pending : other.pending_eager_invocs) + pending_eager_invocs.emplace_back ( + pending->clone_macro_invocation_impl ()); + } + enum class InvocKind { Regular, @@ -721,18 +735,6 @@ class MacroInvocation : public TypeNoBounds, pending_eager_invocs (std::move (pending_eager_invocs)) {} - MacroInvocation (const MacroInvocation &other) - : TraitItem (other.locus), outer_attrs (other.outer_attrs), - locus (other.locus), node_id (other.node_id), - invoc_data (other.invoc_data), is_semi_coloned (other.is_semi_coloned), - kind (other.kind), builtin_kind (other.builtin_kind) - { - if (other.kind == InvocKind::Builtin) - for (auto &pending : other.pending_eager_invocs) - pending_eager_invocs.emplace_back ( - pending->clone_macro_invocation_impl ()); - } - std::vector outer_attrs; location_t locus; NodeId node_id; diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index 65de24bf9d8c..2aecb66ebca4 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -954,8 +954,8 @@ check_match_scrutinee (HIR::MatchExpr &expr, Context *ctx) // this will need to change but for now the first pass implementation, // lets assert this is the case TyTy::ADTType *adt = static_cast (scrutinee_expr_tyty); - rust_assert (adt->is_enum ()); - rust_assert (adt->number_of_variants () > 0); + if (adt->is_enum ()) + rust_assert (adt->number_of_variants () > 0); } else if (scrutinee_kind == TyTy::TypeKind::FLOAT) { diff --git a/gcc/rust/hir/rust-ast-lower-base.cc b/gcc/rust/hir/rust-ast-lower-base.cc index 54c05208e7be..5c1df144813f 100644 --- a/gcc/rust/hir/rust-ast-lower-base.cc +++ b/gcc/rust/hir/rust-ast-lower-base.cc @@ -625,6 +625,7 @@ ASTLoweringBase::lower_generic_args (AST::GenericArgs &args) for (auto &arg : args.get_generic_args ()) { + rust_debug ("[ARTHUR ] %s", arg.as_string ().c_str ()); switch (arg.get_kind ()) { case AST::GenericArg::Kind::Type: { diff --git a/gcc/rust/resolve/rust-ast-resolve-type.cc b/gcc/rust/resolve/rust-ast-resolve-type.cc index bbb05380d2a9..46d14c6b415c 100644 --- a/gcc/rust/resolve/rust-ast-resolve-type.cc +++ b/gcc/rust/resolve/rust-ast-resolve-type.cc @@ -17,6 +17,7 @@ // . #include "rust-ast-resolve-type.h" +#include "rust-ast-dump.h" #include "rust-ast-resolve-expr.h" namespace Rust { @@ -497,10 +498,12 @@ ResolveTypeToCanonicalPath::visit (AST::TraitObjectTypeOneBound &type) } void -ResolveTypeToCanonicalPath::visit (AST::TraitObjectType &) +ResolveTypeToCanonicalPath::visit (AST::TraitObjectType &ty) { // FIXME is this actually allowed? dyn A+B - rust_unreachable (); + // FIXME: This is also reached when we have something like a lifetime bound on + // a generic, e.g. Iter<'a, T: 'a> What do we do in that case? + // rust_unreachable (); } ResolveTypeToCanonicalPath::ResolveTypeToCanonicalPath () diff --git a/gcc/rust/typecheck/rust-hir-type-check-base.cc b/gcc/rust/typecheck/rust-hir-type-check-base.cc index f3edfef4e275..d4cf940e2da4 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-base.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-base.cc @@ -38,6 +38,9 @@ TypeCheckBase::check_for_unconstrained ( const TyTy::SubstitutionArgumentMappings &constraint_b, const TyTy::BaseType *reference) { + rust_debug ("[ARTHUR] %s ", constraint_a.as_string ().c_str ()); + rust_debug ("[ARTHUR] %s ", constraint_b.as_string ().c_str ()); + bool check_result = false; bool check_completed = context->have_checked_for_unconstrained (reference->get_ref (), diff --git a/gcc/rust/typecheck/rust-hir-type-check-item.cc b/gcc/rust/typecheck/rust-hir-type-check-item.cc index 16b4906a3569..5e959a382ec5 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-item.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-item.cc @@ -617,8 +617,8 @@ TypeCheckItem::resolve_impl_block_substitutions (HIR::ImplBlock &impl_block, const TyTy::SubstitutionArgumentMappings impl_constraints = GetUsedSubstArgs::From (self); - failure_flag = check_for_unconstrained (substitutions, trait_constraints, - impl_constraints, self); + // failure_flag = check_for_unconstrained (substitutions, trait_constraints, + // impl_constraints, self); return {substitutions, region_constraints}; } diff --git a/gcc/rust/typecheck/rust-hir-type-check-path.cc b/gcc/rust/typecheck/rust-hir-type-check-path.cc index ad31fb74a80e..e068d2d380c5 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-path.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-path.cc @@ -214,7 +214,8 @@ TypeCheckExpr::resolve_root_path (HIR::PathInExpression &expr, size_t *offset, } rust_error_at (seg.get_locus (), - "failed to type resolve root segment"); + "failed to type resolve root segment: %s", + expr.as_string ().c_str ()); return new TyTy::ErrorType (expr.get_mappings ().get_hirid ()); } diff --git a/gcc/rust/typecheck/rust-hir-type-check-type.cc b/gcc/rust/typecheck/rust-hir-type-check-type.cc index a132b386a965..d7481c7a830d 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-type.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-type.cc @@ -326,6 +326,8 @@ TyTy::BaseType * TypeCheckType::resolve_root_path (HIR::TypePath &path, size_t *offset, NodeId *root_resolved_node_id) { + rust_debug ("[ARTHURl ] %s", path.as_string ().c_str ()); + TyTy::BaseType *root_tyty = nullptr; *offset = 0; for (size_t i = 0; i < path.get_num_segments (); i++) @@ -402,7 +404,8 @@ TypeCheckType::resolve_root_path (HIR::TypePath &path, size_t *offset, if (is_root) { rust_error_at (seg->get_locus (), - "failed to resolve root segment"); + "failed to resolve root segment: %s", + seg->as_string ().c_str ()); return new TyTy::ErrorType (path.get_mappings ().get_hirid ()); } return root_tyty; diff --git a/gcc/rust/typecheck/rust-typecheck-context.cc b/gcc/rust/typecheck/rust-typecheck-context.cc index 9059e0261b32..6081ea251534 100644 --- a/gcc/rust/typecheck/rust-typecheck-context.cc +++ b/gcc/rust/typecheck/rust-typecheck-context.cc @@ -463,18 +463,21 @@ TypeCheckContext::lookup_predicate (HirId id, TyTy::TypeBoundPredicate *result) void TypeCheckContext::insert_query (HirId id) { + rust_debug ("[ARTHUR] INSERTING QUERY: %u", id); querys_in_progress.insert (id); } void TypeCheckContext::query_completed (HirId id) { + rust_debug ("[ARTHUR] COMPLETING QUERY: %u", id); querys_in_progress.erase (id); } bool TypeCheckContext::query_in_progress (HirId id) const { + rust_debug ("[ARTHUR] CHECKING IF QUERY IN PROGRESS: %u", id); return querys_in_progress.find (id) != querys_in_progress.end (); }