TupleIndex index = expr.get_tuple_index ();
if ((size_t) index >= tuple->num_fields ())
{
- rust_error_at (expr.get_locus (), "unknown field at index %i", index);
+ rust_error_at (expr.get_locus (), ErrorCode::E0609,
+ "no field %qi on type %qs", index,
+ resolved->get_name ().c_str ());
return;
}
&lookup, nullptr);
if (!found)
{
- rust_error_at (expr.get_locus (), "unknown field [%s] for type [%s]",
+ rust_error_at (expr.get_locus (), ErrorCode::E0609,
+ "no field %qs on type %qs",
expr.get_field_name ().as_string ().c_str (),
adt->as_string ().c_str ());
return;
--- /dev/null
+#![allow(unused)]
+fn main() {
+ struct StructWithFields {
+ x: u32,
+ }
+
+ let s = StructWithFields { x: 0 };
+ s.foo;
+ // { dg-error "no field .foo. on type .StructWithFields.StructWithFields .x.u32... .E0609." "" { target *-*-* } .-1 }
+
+ let numbers = (1, 2, 3);
+ numbers.3;
+ // { dg-error "no field .3. on type ..<integer>, <integer>, <integer>.. .E0609." "" { target *-*-* } .-1 }
+}