-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Lifetime error messages should have better spans #18759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-bug
Category: This is a bug.
P-medium
Medium priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
Triage: updated code: struct Mine<'a> { s: &'a str }
impl <'a>Iterator for Mine<'a> {
type Item = &'a str;
fn next(&mut self) -> Option<&str> { Some("h") }
}
fn main() {} same error, same problem. |
Current output (updated 2018-02-11):
This case should look more like the following:
|
bors
added a commit
that referenced
this issue
Feb 3, 2018
Tweak presentation on lifetime trait mismatch - On trait/impl method discrepancy, add label pointing at trait signature. - Point only at method definition when referring to named lifetimes on lifetime mismatch. - When the sub and sup expectations are the same, tweak the output to avoid repeated spans. Fix #30790, CC #18759.
19 tasks
Current output, few changes:
|
Current output:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-bug
Category: This is a bug.
P-medium
Medium priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
This error has an arrow pointing where the lifetime issue is (though I don't know why it isn't more precise):
This won't because
next()
is multiline:Best would be:
Someone might easily put the lifetime on
next(&'a self)
instead ofOption<&'a str>
because it didn't point and they didn't understand the message.The text was updated successfully, but these errors were encountered: