Skip to content

Incorrect lifetime suggested in diagnostics help message #35619

Closed
@viraptor

Description

@viraptor

I got the following suggestion for correcting error:

help: consider using an explicit lifetime parameter as shown: fn string_by_path<'a, 'b>(doc: &'a Json, path: &'b [&'b str])
 -> Result<String, Box<Error+ 'c>>
  --> src/main.rs:16:1
   |
16 | fn string_by_path<'a,'b,'c>(doc: &'a Json, path: &'b [&'b str]) -> Result<String, Box<Error + 'c>> {
   | ^

But (irrelevant if this is going towards better solution or not) the suggestion is clearly illegal, because it's missing 'c which exists in the return type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsP-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions