-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Confusing "expected reference, found ..." error when trying to chain Iterator<T> and Iterator<&T> #68095
Copy link
Copy link
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-iteratorsArea: IteratorsArea: IteratorsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.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 lintsA-iteratorsArea: IteratorsArea: IteratorsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.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.
I'm running rustc 1.40.0.
The code:
Trying to compile it results in:
If one focues one the
^^^^^ expected reference, found integerline (as I did) one is faced with the following difficulties:chainidentifier that's underlined/pointed towards here which is (to me) confusingchaincall, it expects references but I give it integers, let's add references" and produce the following:And the error gets even more confusing:
That attempt to fix things was of course totally incorrect, but the error messages don't help here.