-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Changing the type of self in methods doesn't work #27941
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.

The book states:
The reference uses typed self in a few places, but doesn't explain the exact rules.
The compiler also prints redundant and misleading diagnostics:
gives:
Since replacing
Vec<Self>withBox<Self>makes the code compile, "expected structS" isn't quite correct.