-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Lifetime error messages should have better spans #18759
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
mdinger
changed the title
Lifetime error messages would be better with arrows
Multiline function lifetime error messages would be better with arrows
Nov 8, 2014
steveklabnik
added
the
A-diagnostics
Area: Messages for errors, warnings, and lints
label
Jan 27, 2015
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. |
steveklabnik
added
the
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
label
Mar 9, 2017
Mark-Simulacrum
changed the title
Multiline function lifetime error messages would be better with arrows
Lifetime error messages should have better spans
May 31, 2017
Mark-Simulacrum
added
the
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
label
Jul 22, 2017
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:
|
Dylan-DPC
added
C-bug
Category: This is a bug.
and removed
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
labels
May 23, 2023
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: