We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Internal compiler error on stable 1.22.1.
Playground
struct A; struct B; trait Foo<'a> { type Bar; } impl<'a> Foo<'a> for B { type Bar = A; } trait Bar: for<'a> Foo<'a> { fn f<F: for<'a> FnOnce(<Self as Foo<'a>>::Bar)>(&mut self, f: F) {} } impl Bar for B {} fn main() { B.f(drop); }
Output:
error: internal compiler error: /checkout/src/librustc/traits/project.rs:1421: Failed to unify obligation `Obligation(predicate=ProjectionTy { substs: Slice([fn(_) {std::mem::drop::<_>}, (<B as Foo<'a>>::Bar,)]), item_def_id: DefId { krate: CrateNum(2), index: DefIndex(0:951) => core[7b69]::ops[0]::function[0]::FnOnce[0]::Output[0] } },depth=0)` with poly_projection `Binder(ProjectionPredicate(ProjectionTy { substs: Slice([fn(_) {std::mem::drop::<_>}, (A,)]), item_def_id: DefId { krate: CrateNum(2), index: DefIndex(0:951) => core[7b69]::ops[0]::function[0]::FnOnce[0]::Output[0] } }, ()))`: Sorts(ExpectedFound { expected: A, found: <B as Foo<'a>>::Bar }) --> src/main.rs:19:5 | 19 | B.f(drop); | ^ note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports note: rustc 1.22.1 (05e2e1c41 2017-11-22) running on x86_64-unknown-linux-gnu thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:439:8 note: Run with `RUST_BACKTRACE=1` for a backtrace.
The text was updated successfully, but these errors were encountered:
Also possibly a related bug. I'm trying to emulate generic associated types:
trait Foo<'a> { type Bar; } trait Bar: for<'a> Foo<'a> { fn f<F>(&mut self, f: F) where F: for<'a> FnOnce(<Self as Foo<'a>>::Bar) -> <Self as Foo<'a>>::Bar, { } } fn main() {}
I confused with the error:
error[E0582]: binding for associated type Output references lifetime 'a, which does not appear in the trait input types
Output
'a
Input and output should be the same. Why output references 'a, while input not?
If this is not a bug, I'll appreciate any hints to workaround this limitation.
Sorry, something went wrong.
Thanks for the bug report, @valff. Closing as duplicate of #43623.
No branches or pull requests
Internal compiler error on stable 1.22.1.
Playground
Output:
The text was updated successfully, but these errors were encountered: