Skip to content

Commit 0db8774

Browse files
committed
Remove unused and add FIXME
We need to ensure in type resolution pass we fix up the ordering for a struct initilization and give defaults to missing fields.
1 parent e7cf2f7 commit 0db8774

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

gcc/rust/analysis/rust-type-resolution.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,10 @@ TypeResolution::visit (AST::StructExprStructFields &expr)
516516
}
517517
}
518518

519+
// need to correct the ordering with the respect to the struct definition and
520+
// ensure we handle missing values and give them defaults
521+
// FIXME
522+
519523
// setup a path in type
520524
AST::PathIdentSegment seg (expr.get_struct_name ().as_string ());
521525
auto typePath = ::std::unique_ptr<AST::TypePathSegment> (

gcc/rust/backend/rust-compile.cc

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -533,24 +533,6 @@ Compilation::visit (AST::StructExprFieldIdentifier &field)
533533
void
534534
Compilation::visit (AST::StructExprFieldIdentifierValue &field)
535535
{
536-
AST::StructStruct *decl = structBuffer.back ();
537-
size_t index = 0;
538-
bool found = false;
539-
for (auto &df : decl->fields)
540-
{
541-
if (field.field_name.compare (df.field_name) == 0)
542-
{
543-
found = true;
544-
break;
545-
}
546-
}
547-
if (!found)
548-
{
549-
rust_fatal_error (field.value->get_locus_slow (),
550-
"failed to lookup field index");
551-
return;
552-
}
553-
554536
Bexpression *value = NULL;
555537
VISIT_POP (field.value->get_locus_slow (), field.value.get (), value, exprs);
556538
if (value == NULL)

0 commit comments

Comments
 (0)