Added error code for Missing Field in
struct or struct-like enum variant.
gcc/rust/ChangeLog:
* typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::resolve):
called error function.
gcc/testsuite/ChangeLog:
* rust/compile/missing_constructor_fields.rs: New test.
Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
}
else if (!struct_expr.has_struct_base ())
{
- rust_error_at (struct_expr.get_locus (),
+ rust_error_at (struct_expr.get_locus (), ErrorCode ("E0063"),
"constructor is missing fields");
return;
}
--- /dev/null
+// https://doc.rust-lang.org/error_codes/E0063.html
+struct Foo {
+ x: i32,
+ y: i32,
+ z: i32,
+}
+
+fn main() {
+ let x = Foo { x: 0 , y:1 }; // { dg-error "constructor is missing fields" }
+}
\ No newline at end of file