-
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.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.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
Someone had this problem on discord, so creating an issue:
pub union Test<'t> {
i: &'t i64,
f: &'t f64,
}
thread_local! {
static vals: RefCell<HashMap<i32, Vec<Vec<Test>>>> = RefCell::new(HashMap::new());
}
Rust suggests you to:
error[E0106]: missing lifetime specifier
|
| static vals: RefCell<HashMap<i32, Vec<Vec<Test>>>> = RefCell::new(HashMap::new());
| ^^^^ help: consider giving it a 'static lifetime: `Test + 'static`
|
= help: this function's return type contains a borrowed value, but there is no value for it to be
borrowed from
instead it should suggest to use Test<'static>
and not <Test + 'static>
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.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.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.