-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Diagnostics show different expected and found types #68220
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.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.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.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.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.
Found a case where the diagnostics show an incorrect type (missing
&), when calling slice methods taking&T, if the slice is e.g.[&T],[&&T], etc.Thus the diagnostics are incorrect for e.g.
[&str],[&i32],[&&bool], but are correct for e.g.[i32].Unexpected - Example 1
Calling
containson[&str]incorrectly with a&str(instead of&&str). Then the highlighted line saysexpected &str(wrong) and the note after saysexpected type &&str(correct).Diagnostics
Unexpected - Example 2
Second example using a
const[&i32]and callingbinary_searchincorrectly.Diagnostics
Unexpected - Example 3
Diagnostics
Expected - Example 1
Just to reiterate, using
[i32]instead of[&i32]results in the expected error.Diagnostics