1 error[E0271]: expected `TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>` to be an iterator that yields `&_`, but it yields `u8`
2 --> $DIR/issue-31173.rs:6:25
4 LL | let temp: Vec<u8> = it
5 | _________________________^
7 LL | | .take_while(|&x| {
11 | |__________^ expected reference, found `u8`
13 | ------ required by a bound introduced by this call
15 = note: expected reference `&_`
17 note: required by a bound in `cloned`
18 --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
20 LL | Self: Sized + Iterator<Item = &'a T>,
21 | ^^^^^^^^^^^^ required by this bound in `cloned`
23 error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>`, but its trait bounds were not satisfied
24 --> $DIR/issue-31173.rs:13:10
27 | ^^^^^^^ method cannot be called on `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>` due to unsatisfied trait bounds
29 ::: $SRC_DIR/core/src/iter/adapters/take_while.rs:LL:COL
31 LL | pub struct TakeWhile<I, P> {
32 | -------------------------- doesn't satisfy `<_ as Iterator>::Item = &_`
34 ::: $SRC_DIR/core/src/iter/adapters/cloned.rs:LL:COL
36 LL | pub struct Cloned<I> {
37 | -------------------- doesn't satisfy `_: Iterator`
39 = note: the following trait bounds were not satisfied:
40 `<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]> as Iterator>::Item = &_`
41 which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>: Iterator`
42 `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>: Iterator`
43 which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:8:21: 8:25]>>: Iterator`
45 error: aborting due to 2 previous errors
47 Some errors have detailed explanations: E0271, E0599.
48 For more information about an error, try `rustc --explain E0271`.