Skip to content

Commit

Permalink
Compile unit struct with constructor
Browse files Browse the repository at this point in the history
gcc/rust/ChangeLog:

	* backend/rust-compile-resolve-path.cc (ResolvePathRef::resolve): Do
	not use query system for unit struct but compile it's constructor
	instead.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
  • Loading branch information
P-E-P committed Jan 13, 2025
1 parent bd1b05f commit b646b25
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gcc/rust/backend/rust-compile-resolve-path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ ResolvePathRef::resolve (const HIR::PathIdentSegment &final_segment,
}
}

// Handle unit struct
if (lookup->get_kind () == TyTy::TypeKind::ADT)
return attempt_constructor_expression_lookup (lookup, ctx, mappings,
expr_locus);

// let the query system figure it out
tree resolved_item = query_compile (ref, lookup, final_segment, mappings,
expr_locus, is_qualified_path);
Expand Down

0 comments on commit b646b25

Please sign in to comment.