-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an AST
Description
In a pattern matching a struct (or struct-like enum variant), a field can be bound to a variable of the same name by using Thing { foo, ... }
as a shorthand for Thing { foo: foo, ... }
. It would be nice if there were a similar shorthand for Thing { foo: ref foo, ... }
, when the field can't or shouldn't be copied; possibly Thing { ref foo, ... }
, unless that's ambiguous.
Not a big issue, but it would help lower the activation energy for using struct-like variants instead staying with tuple-like variants after the point where they need comments in the definition to keep track of which bool/int/whatever means what (comments which are, of course, not available to the type checker).
Metadata
Metadata
Assignees
Labels
A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an AST