-
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 lintsT-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
We had some codes like below
async fn container(&self, id: &str) -> Result<&Self::Container> {
I think this is a normal case follows lifetime elision rules,
If there are multiple input lifetime positions, but one of them is &self or &mut self, the lifetime of self is assigned to all elided output lifetimes.
But we got a clippy error after we update rust to 1.85
error: elided lifetime has a name
--> src/sandbox.rs:350:51
|
350 | async fn container(&self, id: &str) -> Result<&Self::Container> {
| - ^ this elided lifetime gets resolved as `'life0`
| |
| lifetime `'life0` declared here
|
= note: `-D elided-named-lifetimes` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(elided_named_lifetimes)]`
error: could not compile `runc-sandboxer` (bin "runc-sandboxer" test) due to 1 previous error
Error: Process completed with exit code 101.
Current output
error: elided lifetime has a name
--> src/sandbox.rs:350:51
|
350 | async fn container(&self, id: &str) -> Result<&Self::Container> {
| - ^ this elided lifetime gets resolved as `'life0`
| |
| lifetime `'life0` declared here
|
= note: `-D elided-named-lifetimes` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(elided_named_lifetimes)]`
error: could not compile `runc-sandboxer` (bin "runc-sandboxer" test) due to 1 previous error
Error: Process completed with exit code 101.
Desired output
No compile error
Rationale and extra context
No response
Other cases
Rust Version
Run sudo -E $(command -v cargo) test --all-features
info: syncing channel updates for '1.85-x86_64-unknown-linux-gnu'
info: latest update on 2025-03-18, rust version 1.85.1 (4eb161250 2025-03-15)
Anything else?
No response
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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.