Skip to content
New issue

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

Filter does not build with a trait bounds error #1

Open
mkawalec opened this issue Sep 29, 2022 · 0 comments
Open

Filter does not build with a trait bounds error #1

mkawalec opened this issue Sep 29, 2022 · 0 comments

Comments

@mkawalec
Copy link
Owner

mkawalec commented Sep 29, 2022

For reasons that escape me, trying to instantiate a filter causes a compilation error saying that Filter does not implement the Deluge trait. This is contrary to Filter implementing a Deluge with the exact same parameter bounds as it is instantiated with.

It is essential we figure out why the trait cannot be instantiated and fix the root cause.

The full error message after uncommenting the test:

error[E0599]: the method `collect` exists for struct `filter::Filter<iter::Iter<std::ops::Range<{integer}>>, [closure@src/deluge_ext.rs:420:21: 420:26]>`, but its trait bounds were not satisfied
   --> src/deluge_ext.rs:423:14
    |
423 |             .collect::<Vec<usize>>().await;
    |              ^^^^^^^ method cannot be called on `filter::Filter<iter::Iter<std::ops::Range<{integer}>>, [closure@src/deluge_ext.rs:420:21: 420:26]>` due to unsatisfied trait bounds
    |
   ::: src/ops/filter.rs:4:1
    |
4   | pub struct Filter<Del, F> {
    | -------------------------
    | |
    | method `collect` not found for this struct
    | doesn't satisfy `_: Deluge<'_>`
    | doesn't satisfy `_: Iterator`
    | doesn't satisfy `_: deluge_ext::DelugeExt<'_>`
    |
note: the following trait bounds were not satisfied:
      `&filter::Filter<iter::Iter<std::ops::Range<{integer}>>, [closure@src/deluge_ext.rs:420:21: 420:26]>: Deluge<'_>`
      `&mut filter::Filter<iter::Iter<std::ops::Range<{integer}>>, [closure@src/deluge_ext.rs:420:21: 420:26]>: Deluge<'_>`
      `filter::Filter<iter::Iter<std::ops::Range<{integer}>>, [closure@src/deluge_ext.rs:420:21: 420:26]>: Deluge<'_>`
   --> src/deluge_ext.rs:7:42
    |
7   | impl<'a, T> DelugeExt<'a> for T where T: Deluge<'a> {}
    |             -------------     -          ^^^^^^^^^^ unsatisfied trait bound introduced here
    = note: the following trait bounds were not satisfied:
            `filter::Filter<iter::Iter<std::ops::Range<{integer}>>, [closure@src/deluge_ext.rs:420:21: 420:26]>: Iterator`
            which is required by `&mut filter::Filter<iter::Iter<std::ops::Range<{integer}>>, [closure@src/deluge_ext.rs:420:21: 420:26]>: Iterator`
note: the following traits must be implemented
   --> src/deluge.rs:11:1
    |
11  | pub trait Deluge<'a> {
    | ^^^^^^^^^^^^^^^^^^^^
    |
   ::: /home/michal/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:67:1
    |
67  | pub trait Iterator {
    | ^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0599`.
error: could not compile `deluge` due to previous error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant