E0027 suggestion introduces refactoring-hazard #132008
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
I often find myself trying to write code in such a way that future changes to a
struct
, require me to look at all uses, since they may not accurately reflect what I want after the refactoring. The current suggestion actively goes against that, ignoring future field-additions.Ignoring fields is of course still a valid option in some cases, so the new suggestion would give both variants, allowing the user to choose which is more appropriate in this case (and making them aware of the trade-offs).
At the very least the message should reflect the trade-offs made when writing
..
(also ignoring all fields added in the future).Other cases
The error message for three fields:
It is unclear to me whether for more than one field the error message should just scale to more fields (
field2: _, field3: _
) or just suggest the..
syntax and warn that it might result in unwanted ignored fields if more fields are added.Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: