Closed
Description
Small variation of #19126
STR
#![feature(unboxed_closures)]
fn foo<T, F: FnOnce(T) -> T>(f: F) {}
fn id<'a>(input: &'a u8) -> &'a u8 { input }
fn main() {
foo(id);
}
Output
reskolemized.rs:7:5: 7:8 error: cannot infer an appropriate lifetime due to conflicting requirements
reskolemized.rs:7 foo(id);
^~~
note: first, the lifetime cannot outlive lifetime ReInfer(ReSkolemized(1, BrNamed(DefId { krate: 0, node: 31 }, "'a"(71))))...
reskolemized.rs:7:5: 7:8 note: ...so that trait type parameters matches those specified on the impl (expected `core::ops::Fn<(&u8,), &u8>`, found `core::ops::Fn<(&u8,), &u8>`)
reskolemized.rs:7 foo(id);
^~~
reskolemized.rs:7:5: 7:8 note: but, the lifetime must be valid for the expression at 7:4...
reskolemized.rs:7 foo(id);
^~~
reskolemized.rs:7:5: 7:8 note: ...so that type parameter instantiated with `&u8`, will meet its declared lifetime bounds.
reskolemized.rs:7 foo(id);
^~~
error: aborting due to previous error
Version
#19113 + #18868 on top of bfaa7bc
Not sure if this should work or not, but the error message could be improved.