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
I had asked for help on the Rust user forum, but from what I've learned, Rust provides no way to specify lifetimes in a way to succesfully run the loop in the drop-method in the following example:
Compiling playground v0.0.1 (/playground)
error[E0367]: The requirement `for<'b> <&'b TCollection as std::iter::IntoIterator>::Item == &'b ()` is added only by the Drop impl.
--> src/lib.rs:8:1
|
8 | / impl<TCollection> Drop for MyStruct<TCollection>
9 | | where
10 | | for<'b> &'b TCollection: IntoIterator<Item = &'b ()>,
11 | | {
... |
14 | | }
15 | | }
| |_^
|
note: The same requirement must be part of the struct/enum definition
--> src/lib.rs:1:1
|
1 | / struct MyStruct<TCollection>
2 | | where
3 | | for<'a> &'a TCollection: IntoIterator<Item = &'a ()>,
4 | | {
5 | | references: TCollection,
6 | | }
| |_^
error[E0367]: The requirement `for<'b> &'b TCollection: std::iter::IntoIterator` is added only by the Drop impl.
--> src/lib.rs:8:1
|
8 | / impl<TCollection> Drop for MyStruct<TCollection>
9 | | where
10 | | for<'b> &'b TCollection: IntoIterator<Item = &'b ()>,
11 | | {
... |
14 | | }
15 | | }
| |_^
|
note: The same requirement must be part of the struct/enum definition
--> src/lib.rs:1:1
|
1 | / struct MyStruct<TCollection>
2 | | where
3 | | for<'a> &'a TCollection: IntoIterator<Item = &'a ()>,
4 | | {
5 | | references: TCollection,
6 | | }
| |_^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0367`.
error: could not compile `playground`.
To learn more, run the command again with --verbose.
Rust should be able to determine, that the where-clause in the struct and the Drop-impl are compatible. I consider this a bug.
The text was updated successfully, but these errors were encountered:
I had asked for help on the Rust user forum, but from what I've learned, Rust provides no way to specify lifetimes in a way to succesfully run the loop in the
drop
-method in the following example:(Playground)
Errors:
Rust should be able to determine, that the
where
-clause in the struct and theDrop
-impl are compatible. I consider this a bug.The text was updated successfully, but these errors were encountered: