Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desugar AST::ForLoopExprs as part of HIR lowering #2903

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions gcc/rust/ast/rust-macro.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,8 @@ class MacroRulesDefinition : public VisItem
DeclMacro,
};

MacroRulesDefinition (const MacroRulesDefinition &other) = default;

private:
std::vector<Attribute> outer_attrs;
Identifier rule_name;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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<Attribute> outer_attrs;
location_t locus;
NodeId node_id;
Expand Down
4 changes: 2 additions & 2 deletions gcc/rust/backend/rust-compile-expr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<TyTy::ADTType *> (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)
{
Expand Down
1 change: 1 addition & 0 deletions gcc/rust/hir/rust-ast-lower-base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Loading
Loading