-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Suggestion: say "field is never read" instead of "field is never used" #64465
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
As of rustc 1.37.0, this code:
gives the warning:
I understand that the compiler can optimize out the
treefield. Forgive me for stating the obvious; namely, the warning doesn't mention anything about "optimizing away" the field; it only says "field is never used". A user would be justified in thinking: "this warning doesn't make sense; theOwl::findmethod most certainly uses thetreefield.Suggestion
I'd suggest changing the warning to say "warning: field is never read".
Rationale
By the common understanding of the word 'use', the
treefield indeed is 'used', because the word 'use' can mean 'read' or 'write'. Being more specific (i.e. saying "field is never read") will help users understand what kind of use the compiler means.This issue has been assigned to @CosineP via this comment.