diff options
author | Tom Tromey <tom@tromey.com> | 2018-03-19 10:25:05 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-03-19 11:01:31 -0600 |
commit | 926300415b642367cdc2febac6619f8cb8a80b46 (patch) | |
tree | 4b0859a0bdf08f69f8ceb3e2ce69ad6bf1cf4441 /bfd | |
parent | 76727919ceb590f03ff0f6db08b7ceab5b7aeaff (diff) | |
download | gdb-926300415b642367cdc2febac6619f8cb8a80b46.zip gdb-926300415b642367cdc2febac6619f8cb8a80b46.tar.gz gdb-926300415b642367cdc2febac6619f8cb8a80b46.tar.bz2 |
Support bare-identifier field initializers in Rust
In Rust one can initialize a struct member from an identically-named
local variable by simply mentioning the member name in the
initializer, like:
let x = 0;
let y = Struct { x };
This initializes "Struct::x" from "x".
This patch adds this form of initializer to the Rust expression parser
and adds a test.
Tested on x86-64 Fedora 26 using rustc 1.23.
2018-03-19 Tom Tromey <tom@tromey.com>
* rust-exp.y (struct_expr_tail, struct_expr_list): Add plain
"IDENT" production.
2018-03-19 Tom Tromey <tom@tromey.com>
* gdb.rust/simple.rs (main): Add local variables field1, field2,
y0.
* gdb.rust/simple.exp: Test bare identifier form of struct
initializer.
Diffstat (limited to 'bfd')
0 files changed, 0 insertions, 0 deletions