We just had a typo returning ok true when it should have been false.
Fixes Rust-GCC#3876
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::visit): fix typo
gcc/testsuite/ChangeLog:
* rust/compile/issue-3876.rs: New test.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
if (!ok)
{
rust_error_at (field.get_locus (), "unknown field");
- return true;
+ return false;
}
auto it = adtFieldIndexToField.find (field_index);
--- /dev/null
+enum test {
+ A(i32),
+}
+
+fn fun(x: i32) {
+ test::A { x }
+ // { dg-error "unknown field" "" { target *-*-* } .-1 }
+}