-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.Category: This is a bug.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.
Description
trait X { fn foo(&self) {} }
fn p3<'a, 'b, T: 'b>(v: T) -> Box<dyn X + 'a> where T: X {
Box::new(v)
}
produces:
error[E0309]: the parameter type `T` may not live long enough
--> src/lib.rs:4:5
|
3 | fn p3<'a, 'b, T: 'b>(v: T) -> Box<dyn X + 'a> where T: X {
| -- help: consider adding an explicit lifetime bound `T: 'a`...
4 | Box::new(v)
| ^^^^^^^^^^^
|
It should suggest T: 'a + 'b
(or similar), ideally in the same format as E0599.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.Category: This is a bug.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.