You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<anon>:3:21: 3:22 error: mismatched types:
expected `core::marker::CovariantLifetime<'s>`,
found `core::marker::CovariantLifetime<'b>`
(lifetime mismatch) [E0308]
<anon>:3 Box::new(move ||y)
^
<anon>:3:21: 3:22 note: the lifetime 's as defined on the block at 3:20...
<anon>:3 Box::new(move ||y)
^
<anon>:2:72: 4:2 note: ...does not necessarily outlive the lifetime 'b as defined on the block at 2:71
<anon>:2 fn does_not_compile<'b>(y: CLT<'b>) -> Box<for<'s:'b> Fn() -> CLT<'s>> {
<anon>:3 Box::new(move ||y)
<anon>:4 }
error: aborting due to previous error
playpen: application terminated with error code 101
The text was updated successfully, but these errors were encountered:
arielb1
changed the title
Bounds in HIgher-Ranked Lifetimes in trait objects don't seem to work
Bounds in Higher-Ranked Lifetimes in trait objects don't seem to work
Mar 5, 2015
Triage: I am not sure how to reproduce this, as PhantomData is the replacement for the old *Lifetime types, and I am terrible with remembering the various variances. @arielb1 any idea about this today?
I can't reproduce this failure today, but it might be due to a lack of understanding how to do it with PhantomData. I'm going to give this a close since I think it's no longer relevant, but please do reopen with a modern example if possible. What I came up with is below, but it doesn't work.
error[E0582]: binding for associated type `Output` references lifetime `'s`, which does not appear in the trait input types
--> test.rs:3:76
|
3 | fn does_not_compile<'b>(y: PhantomData<&'b ()>) -> Box<for<'s: 'b> Fn() -> PhantomData<&'s ()>> {
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
Error:
The text was updated successfully, but these errors were encountered: