Skip to content

cargo +nightly build error as unsatisfied trait bounds #48

Description

@Curricane

Describe the bug
i can not run cargo +nightly build as unsatisfied trait bounds.

To Reproduce
Steps to reproduce the behavior:

rustc version: rustc 1.76.0-nightly (a1a37735c 2023-11-23)
delay_timer commit 69a3867

  1. cd delay_timer
  2. cargo +nightly build

then error will show like:

error[E0277]: the trait bound `StrSearcher<'_, '_>: DoubleEndedSearcher<'_>` is not satisfied                                                                     [0/583]
    --> src/utils/parse.rs:371:83
     |
371  |         let mut sub_command_inner = command.trim().split_inclusive(angle_bracket).rev();
     |                                                                                   ^^^ the trait `DoubleEndedSearcher<'_>` is not implemented for `StrSearcher<'_, '_>`
     |
     = help: the following other types implement trait `DoubleEndedSearcher<'a>`:
               CharSearcher<'a>
               CharArraySearcher<'a, N>
               CharArrayRefSearcher<'a, 'b, N>
               CharSliceSearcher<'a, 'b>
               CharPredicateSearcher<'a, F>
     = note: required for `std::str::SplitInclusive<'_, &str>` to implement `DoubleEndedIterator`
note: required by a bound in `rev`
    --> /home/chenmc/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:3399:23
     |
3397 |     fn rev(self) -> Rev<Self>
     |        --- required by a bound in this associated function
3398 |     where
3399 |         Self: Sized + DoubleEndedIterator,
     |                       ^^^^^^^^^^^^^^^^^^^ required by this bound in `Iterator::rev`

error[E0599]: the method `next` exists for struct `Rev<SplitInclusive<'_, &str>>`, but its trait bounds were not satisfied
    --> src/utils/parse.rs:374:14
     |
373  | /         sub_command_inner
374  | |             .next()
     | |             -^^^^ method cannot be called on `Rev<SplitInclusive<'_, &str>>` due to unsatisfied trait bounds
     | |_____________|
     |
     |
    ::: /home/chenmc/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/str/iter.rs:1216:1
     |
1216 |   pub struct SplitInclusive<'a, P: Pattern<'a>>(pub(super) SplitInternal<'a, P>);
     |   --------------------------------------------- doesn't satisfy `_: DoubleEndedIterator`
     |
    ::: /home/chenmc/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/adapters/rev.rs:15:1
     |
15   |   pub struct Rev<T> {
     |   ----------------- doesn't satisfy `Rev<std::str::SplitInclusive<'_, &str>>: Iterator`
     |
     = note: the following trait bounds were not satisfied:
             `std::str::SplitInclusive<'_, &str>: DoubleEndedIterator`
             which is required by `Rev<std::str::SplitInclusive<'_, &str>>: Iterator`

Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `delay_timer` (lib) due to 2 previous errors

Expected behavior
compile ok

Screenshots

Desktop (please complete the following information):

  • OS: archlinux

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions