diff options
author | Tom Tromey <tom@tromey.com> | 2016-07-11 15:02:10 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2016-07-21 15:16:04 -0600 |
commit | 12df5c002dcbfc5ac54983e1e7040a182f71a753 (patch) | |
tree | 6008ef91eacbb303c3b821642fa012b3cd3b1dd1 /gdb/testsuite | |
parent | 305450edd3f96bfeebff78300e1e93487563d90a (diff) | |
download | binutils-gdb-12df5c002dcbfc5ac54983e1e7040a182f71a753.tar.gz |
Allow empty struct expressions in Rust
I learned recently that empty struct expressions, like "X{}", have been
promoted from experimental to stable in Rust. This patch changes the
Rust expression parser to allow this case.
New test case included.
Built and regtested on x86-64 Fedora 23, using Rust 1.11 beta.
2016-07-21 Tom Tromey <tom@tromey.com>
* rust-lang.c (rust_tuple_struct_type_p): Return false for empty
structs.
* rust-exp.y (struct_expr_list): Allow empty elements.
2016-07-21 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.rs (main): Use empty struct expression.
* gdb.rust/simple.exp: Add tests for empty struct expression.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.rust/simple.exp | 3 | ||||
-rw-r--r-- | gdb/testsuite/gdb.rust/simple.rs | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index d985c884e02..547776147c4 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-07-21 Tom Tromey <tom@tromey.com> + + * gdb.rust/simple.rs (main): Use empty struct expression. + * gdb.rust/simple.exp: Add tests for empty struct expression. + 2016-07-21 Yao Qi <yao.qi@linaro.org> * lib/gdbserver-support.exp (skip_gdbserver_tests): Return 1 diff --git a/gdb/testsuite/gdb.rust/simple.exp b/gdb/testsuite/gdb.rust/simple.exp index 32b3785c971..5e00b03c088 100644 --- a/gdb/testsuite/gdb.rust/simple.exp +++ b/gdb/testsuite/gdb.rust/simple.exp @@ -55,7 +55,10 @@ gdb_test "print *(&c as *mut i32)" " = 0" gdb_test "print j" " = simple::Unit" gdb_test "ptype j" " = struct simple::Unit" +gdb_test "print j2" " = simple::Unit" +gdb_test "ptype j2" " = struct simple::Unit" gdb_test "print simple::Unit" " = simple::Unit" +gdb_test "print simple::Unit{}" " = simple::Unit" gdb_test "print g" " = \\(u8 \\(\\*\\)\\\[6\\\]\\) $hex b\"hi bob\"" gdb_test "ptype g" " = u8 \\(\\*\\)\\\[6\\\]" diff --git a/gdb/testsuite/gdb.rust/simple.rs b/gdb/testsuite/gdb.rust/simple.rs index 49808261324..eeff3d71f9c 100644 --- a/gdb/testsuite/gdb.rust/simple.rs +++ b/gdb/testsuite/gdb.rust/simple.rs @@ -81,6 +81,7 @@ fn main () { let i = ["whatever"; 8]; let j = Unit; + let j2 = Unit{}; let k = SpaceSaver::Nothing; let l = SpaceSaver::Thebox(9, Box::new(1729)); |