Skip to content

unsatisfyable HKL error message prints broken bound (for<'b> 'b : ) #35180

Open
@oli-obk

Description

@oli-obk

the full error is

error[E0279]: the requirement `for<'b> 'b : ` is not satisfied (`expected bound lifetime parameter 'b, found concrete lifetime`)
 --> <anon>:2:5
  |
2 |     test::<FooS>(&mut 42);
  |     ^^^^^^^^^^^^
  |
  = note: required because of the requirements on the impl of `for<'b> Foo<'b>` for `FooS<'_>`
  = note: required by `test`

reproducible example on stable, beta and nightly:

fn main() {
    test::<FooS>(&mut 42);
}

trait Foo<'a> {}

struct FooS<'a> {
    data: &'a mut u32,
}

impl<'a, 'b: 'a> Foo<'b> for FooS<'a> {}

fn test<'a, F>(data: &'a mut u32) where F: for<'b> Foo<'b> {}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.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