diff options
Diffstat (limited to 'gcc/rust/backend/rust-compile-resolve-path.cc')
-rw-r--r-- | gcc/rust/backend/rust-compile-resolve-path.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-resolve-path.cc b/gcc/rust/backend/rust-compile-resolve-path.cc index 8c1b7ef..f799445 100644 --- a/gcc/rust/backend/rust-compile-resolve-path.cc +++ b/gcc/rust/backend/rust-compile-resolve-path.cc @@ -64,6 +64,13 @@ ResolvePathRef::resolve (const HIR::PathIdentSegment &final_segment, return error_mark_node; TyTy::ADTType *adt = static_cast<TyTy::ADTType *> (lookup); + + // it might be a unit-struct + if (adt->is_unit ()) + { + return ctx->get_backend ()->unit_expression (); + } + if (!adt->is_enum ()) return error_mark_node; @@ -121,6 +128,14 @@ ResolvePathRef::resolve (const HIR::PathIdentSegment &final_segment, return ctx->get_backend ()->var_expression (var, expr_locus); } + // might be a match pattern binding + tree binding = error_mark_node; + if (ctx->lookup_pattern_binding (ref, &binding)) + { + TREE_USED (binding) = 1; + return binding; + } + // it might be a function call if (lookup->get_kind () == TyTy::TypeKind::FNDEF) { |