-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
E0277 focuses on the wrong part of the line. #100560
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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 lintsT-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.
So i've got some code like this:
What is wrong: The
delimited_bytakes a parser for what occurs immediately before and immediately after the parser you call the method on. So it has a: Parser<I, O>trait bound. Except thatPunctuation('[')is a token, not a parser for a token. What I should have written isjust(Punctuation('[')).What Rustc Tells You:
The Problem: The part that's "wrong" in the line is the argument, not the method call. The way the error describes things, it makes it sound like the method doesn't exist because the thing i'm calling it on doesn't satisfy some trait bound or something like that. Which, if this were nearly any other language, would sound like a silly thing to worry about, but with rust that's a genuine concern.
How I Think Rustc Should Show The Error:
Instead of focusing on
delimited_byas having the error, it should focus on the argument todelimited_byas having the error.