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
error[E0700]: hidden type for `impl MyTrait + 'static` captures lifetime that does not appear in bounds
--> core\src\pipeline\sbt.rs:222:5
|
221 | fn outer(data: &[u8]) -> impl MyTrait + 'static {
| ----- hidden type `impl MyTrait + 'static` captures the anonymous lifetime defined here
222 | / inner(|dst| {
223 | | dst.copy_from_slice(data)
224 | | })
| |______^
For more information about this error, try `rustc --explain E0700`.
The writer argument is just a impl FnOnce(&mut [u8]) with no lifetime bounds.
The lifetime there is a HRTB, the full trait def is for<'a> FnOnce(&'a mut [u8])
It says the closure needs to accept any mutable byte slice, regardless of the slices lifetime.
It should have no impact on the lifetime of the closure.
I tried this code:
I expected to see this compile.
Instead, I get this error:
The writer argument is just a
impl FnOnce(&mut [u8])
with no lifetime bounds.The lifetime there is a HRTB, the full trait def is
for<'a> FnOnce(&'a mut [u8])
It says the closure needs to accept any mutable byte slice, regardless of the slices lifetime.
It should have no impact on the lifetime of the closure.
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: