mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-18 12:24:38 +08:00
Make Rust error message mention the field name
I noticed a spot in rust-lang.c where the placeholder "foo" was used instead of the actual field name. This patch fixes the bug. gdb/ChangeLog 2018-09-13 Tom Tromey <tom@tromey.com> PR rust/23650: * rust-lang.c (rust_evaluate_subexp): Use field name, not "foo". gdb/testsuite/ChangeLog 2018-09-13 Tom Tromey <tom@tromey.com> PR rust/23650: * gdb.rust/simple.exp: Add test for enum field access error.
This commit is contained in:
parent
098b2108a2
commit
4a3fe98f88
@ -1,3 +1,8 @@
|
||||
2018-09-13 Tom Tromey <tom@tromey.com>
|
||||
|
||||
PR rust/23650:
|
||||
* rust-lang.c (rust_evaluate_subexp): Use field name, not "foo".
|
||||
|
||||
2018-09-13 Tom Tromey <tom@tromey.com>
|
||||
|
||||
PR rust/23626:
|
||||
|
@ -1726,9 +1726,9 @@ tuple structs, and tuple-like enum variants"));
|
||||
struct type *outer_type = type;
|
||||
type = value_type (lhs);
|
||||
if (rust_tuple_type_p (type) || rust_tuple_struct_type_p (type))
|
||||
error (_("Attempting to access named field foo of tuple "
|
||||
error (_("Attempting to access named field %s of tuple "
|
||||
"variant %s::%s, which has only anonymous fields"),
|
||||
TYPE_NAME (outer_type),
|
||||
field_name, TYPE_NAME (outer_type),
|
||||
rust_last_path_segment (TYPE_NAME (type)));
|
||||
|
||||
TRY
|
||||
|
@ -1,3 +1,8 @@
|
||||
2018-09-13 Tom Tromey <tom@tromey.com>
|
||||
|
||||
PR rust/23650:
|
||||
* gdb.rust/simple.exp: Add test for enum field access error.
|
||||
|
||||
2018-09-13 Tom Tromey <tom@tromey.com>
|
||||
|
||||
PR rust/23626:
|
||||
|
@ -134,6 +134,8 @@ gdb_test "print univariant" " = simple::Univariant::Foo{a: 1}"
|
||||
gdb_test "print univariant.a" " = 1"
|
||||
gdb_test "print univariant_anon" " = simple::UnivariantAnon::Foo\\(1\\)"
|
||||
gdb_test "print univariant_anon.0" " = 1"
|
||||
gdb_test "print univariant_anon.sss" \
|
||||
"Attempting to access named field sss of tuple variant simple::UnivariantAnon::Foo, which has only anonymous fields"
|
||||
|
||||
gdb_test_sequence "ptype simple::Univariant" "" {
|
||||
"type = enum simple::Univariant \\{"
|
||||
|
Loading…
Reference in New Issue
Block a user