-
Notifications
You must be signed in to change notification settings - Fork 13.3k
E310 uses weird terminology #36700
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
The note added today improves the situation but the main error message could still be enhanced. struct Foo<T> {
foo: &'static T
}
|
Related: #33652 |
bors
added a commit
that referenced
this issue
Sep 27, 2017
Point at parameter type on E0301 On "the parameter type `T` may not live long enough" error, point to the parameter type suggesting lifetime bindings: ``` error[E0310]: the parameter type `T` may not live long enough --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5 | 27 | struct Foo<T> { | - help: consider adding an explicit lifetime bound `T: 'static`... 28 | foo: &'static T | ^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5 | 28 | foo: &'static T | ^^^^^^^^^^^^^^^ ``` Fix #36700.
I don't think this should have been closed. #44782 is a good improvement of the error message, but did not change the primary message. It still says "the parameter type (I can't re-open, could someone with more permissions do that please?) |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
For context, the message is, in the case of a type parameter
T
missing a lifetime bound:The suggestion that follows (adding a lifetime bound to
T
) is fine, but I've just seen someone confused by the wording of the actual error message. Irrespective of any misconceptions or lack of knowledge that might have factored in that specific person's confusion, this message does seem to use very strange terminology. Types, as opposed to values, don't really live (it's occasionally convenient to make puns about this, but in this case it hurts), and it's not really a question of how long a value of typeT
lives but rather of lifetime parameters contained inT
. Also, "parameter type" looks odd — "type parameter" seems much more common.I'd suggest something like
The exact wording is just a straw man, I don't think it's optimal.
The text was updated successfully, but these errors were encountered: