This is the mail archive of the gdb-testers@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Support bare-identifier field initializers in Rust


*** TEST RESULTS FOR COMMIT 926300415b642367cdc2febac6619f8cb8a80b46 ***

Author: Tom Tromey <tom@tromey.com>
Branch: master
Commit: 926300415b642367cdc2febac6619f8cb8a80b46

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]