Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
oli-obk opened this issue Aug 2, 2016 · 6 comments · Fixed by #64085
Open

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

oli-obk opened this issue Aug 2, 2016 · 6 comments · Fixed by #64085
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Aug 2, 2016

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> {}
@kennytm
Copy link
Member

kennytm commented Apr 11, 2017

Another program which produces similar message:

trait R<'a, 's: 'a> {}

impl<'a, 's: 'a> R<'a, 's> for u32 {}

struct S<X: for<'a> R<'a, 'static>>(X);

fn f(x: S<u32>) {}

Error:

error: main function not found

error[E0279]: the requirement `for<'a>  : 'a` is not satisfied (`expected bound lifetime parameter 'a, found concrete lifetime`)
 --> 1.rs:7:1
  |
7 | fn f(x: S<u32>) {}
  | ^^^^^^^^^^^^^^^^^^
  |
  = note: required because of the requirements on the impl of `for<'a> R<'a, 'static>` for `u32`
  = note: required by `S`

error: aborting due to previous error

BTW,


Version:

rustc 1.18.0-nightly (3b5754e5c 2017-04-10)
binary: rustc
commit-hash: 3b5754e5ce73d24c6684b3ed0c68a557dfdd2f52
commit-date: 2017-04-10
host: x86_64-apple-darwin
release: 1.18.0-nightly
LLVM version: 3.9

@Mark-Simulacrum Mark-Simulacrum added the A-diagnostics Area: Messages for errors, warnings, and lints label Jun 20, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 25, 2017
@estebank
Copy link
Contributor

estebank commented Sep 2, 2019

Current output:

error: implementation of `Foo` is not general enough
 --> src/main.rs:2:5
  |
2 |     test::<FooS>(&mut 42);
  |     ^^^^^^^^^^^^
  |
  = note: Due to a where-clause on `test`,
  = note: `FooS<'_>` must implement `Foo<'0>`, for any lifetime `'0`
  = note: but `FooS<'_>` actually implements `Foo<'1>`, for some specific lifetime `'1`

The case in the comment now compiles.


Working on a PR to make the output:

error: implementation of `Foo` is not general enough
  --> file.rs:2:5
   |
2  |     test::<FooS>(&mut 42);
   |     ^^^^^^^^^^^^
...
13 | fn test<'a, F>(data: &'a mut u32) where F: for<'b> Foo<'b> {}
   | ------------------------------------------------------------- due to a where-clause on `test`...
   |
   = note: ...`FooS<'_>` must implement `Foo<'0>`, for any lifetime `'0`...
   = note: ...but `FooS<'_>` actually implements `Foo<'1>`, for some specific lifetime `'1`

tmandry added a commit to tmandry/rust that referenced this issue Sep 10, 2019
Centril added a commit to Centril/rust that referenced this issue Sep 10, 2019
@bors bors closed this as completed in 3edc644 Sep 17, 2019
@estebank estebank reopened this Sep 27, 2019
@estebank estebank added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 27, 2019
@onlineSoftwareDevOK
Copy link
Contributor

Is it possible to reproduce E0279 using Rust stable nowadays? I am writing documentation for that error. Every code snippet which used to throw that error now returns implementation of X is not general enough

@onlineSoftwareDevOK
Copy link
Contributor

Is it possible to reproduce E0279 using Rust stable nowadays? I am writing documentation for that error. Every code snippet which used to throw that error now returns implementation of X is not general enough

@estebank Do you know this?

@onlineSoftwareDevOK
Copy link
Contributor

Is it possible to reproduce E0279 using Rust stable nowadays? I am writing documentation for that error. Every code snippet which used to throw that error now returns implementation of X is not general enough

@spastorino @nikomatsakis Do you know this?

@estebank
Copy link
Contributor

Theoretically, yes (the code is still there to produce the error), but we have no test for it in the test suite and it's possible that it has been shadowed by other, newer errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants