Skip to content

Missing in_band_lifetimes suggestion #73775

Closed
@leonardo-m

Description

@leonardo-m
//#![feature(in_band_lifetimes)]
fn foo(data: &'a mut [u32]) -> &'a [u32] {
    data
}
fn main() {}

Gives (rustc 1.46.0-nightly 50fc24d 2020-06-25):

error[E0261]: use of undeclared lifetime name `'a`
 --> ...\test.rs:2:15
  |
2 | fn foo(data: &'a mut [u32]) -> &'a [u32] {
  |       -       ^^ undeclared lifetime
  |       |
  |       help: consider introducing lifetime `'a` here: `<'a>`

error[E0261]: use of undeclared lifetime name `'a`
 --> ...\test.rs:2:33
  |
2 | fn foo(data: &'a mut [u32]) -> &'a [u32] {
  |       -                         ^^ undeclared lifetime
  |       |
  |       help: consider introducing lifetime `'a` here: `<'a>`

Like most other features I'd like rustc to suggest using in_band_lifetimes if it's a Nightly compiler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-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