diff --git a/gcc/rust/ast/rust-macro.h b/gcc/rust/ast/rust-macro.h index 507e595e3790..a60d093a680a 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, @@ -726,19 +740,6 @@ class MacroInvocation : public TypeNoBounds, pending_eager_invocs (std::move (pending_eager_invocs)) {} - MacroInvocation (const MacroInvocation &other) - : TraitItem (other.locus), ExternalItem (other.node_id), - 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 6a9bb73ffe0f..1bed4525bbba 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 bd26e7019c30..754c0be1904b 100644 --- a/gcc/rust/hir/rust-ast-lower-base.cc +++ b/gcc/rust/hir/rust-ast-lower-base.cc @@ -621,6 +621,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/hir/rust-ast-lower.cc b/gcc/rust/hir/rust-ast-lower.cc index c10c99549f2b..4e4c0aa512c7 100644 --- a/gcc/rust/hir/rust-ast-lower.cc +++ b/gcc/rust/hir/rust-ast-lower.cc @@ -534,11 +534,11 @@ ASTLoweringExprWithBlock::visit (AST::ForLoopExpr &expr) *Analysis::Mappings::get ()}; auto head = std::unique_ptr ( - ASTLoweringExpr::translate (expr.get_iterator_expr ().get ())); + ASTLoweringExpr::translate (expr.get_iterator_expr ())); auto pat = std::unique_ptr ( - ASTLoweringPattern::translate (expr.get_pattern ().get ())); + ASTLoweringPattern::translate (expr.get_pattern ())); auto body = std::unique_ptr ( - ASTLoweringExpr::translate (expr.get_loop_block ().get ())); + ASTLoweringExpr::translate (expr.get_loop_block ())); rust_assert (head); rust_assert (pat); diff --git a/gcc/rust/resolve/rust-ast-resolve-type.cc b/gcc/rust/resolve/rust-ast-resolve-type.cc index df1e7ee1a450..8afe7c259d4f 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 { @@ -496,10 +497,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 3e504e5df322..f99aeca9cbd4 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-item.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-item.cc @@ -685,8 +685,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 dd6ab03a3627..83add09888e4 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-path.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-path.cc @@ -224,7 +224,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 44ebc159b23a..1f4ef4c7292c 100644 --- a/gcc/rust/typecheck/rust-hir-type-check-type.cc +++ b/gcc/rust/typecheck/rust-hir-type-check-type.cc @@ -331,6 +331,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++) @@ -417,7 +419,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 ab0093a273b4..b1e29508ad44 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 (); }