]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mismatched_types/issue-36053-2.stderr
Consider privacy more carefully when suggesting accessing fields
[rust.git] / src / test / ui / mismatched_types / issue-36053-2.stderr
1 error[E0631]: type mismatch in closure arguments
2   --> $DIR/issue-36053-2.rs:7:32
3    |
4 LL |     once::<&str>("str").fuse().filter(|a: &str| true).count();
5    |                                ^^^^^^ --------- found signature defined here
6    |                                |
7    |                                expected due to this
8    |
9    = note: expected closure signature `for<'r> fn(&'r &str) -> _`
10               found closure signature `for<'r> fn(&'r str) -> _`
11 note: required by a bound in `filter`
12   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
13    |
14 LL |         P: FnMut(&Self::Item) -> bool,
15    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `filter`
16
17 error[E0599]: the method `count` exists for struct `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>`, but its trait bounds were not satisfied
18   --> $DIR/issue-36053-2.rs:7:55
19    |
20 LL |     once::<&str>("str").fuse().filter(|a: &str| true).count();
21    |                                       ---------       ^^^^^ method cannot be called on `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>` due to unsatisfied trait bounds
22    |                                       |
23    |                                       doesn't satisfy `<_ as FnOnce<(&&str,)>>::Output = bool`
24    |                                       doesn't satisfy `_: FnMut<(&&str,)>`
25    |
26   ::: $SRC_DIR/core/src/iter/adapters/filter.rs:LL:COL
27    |
28 LL | pub struct Filter<I, P> {
29    | ----------------------- doesn't satisfy `_: Iterator`
30    |
31    = note: the following trait bounds were not satisfied:
32            `<[closure@$DIR/issue-36053-2.rs:7:39: 7:48] as FnOnce<(&&str,)>>::Output = bool`
33            which is required by `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>: Iterator`
34            `[closure@$DIR/issue-36053-2.rs:7:39: 7:48]: FnMut<(&&str,)>`
35            which is required by `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>: Iterator`
36            `Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>: Iterator`
37            which is required by `&mut Filter<Fuse<std::iter::Once<&str>>, [closure@$DIR/issue-36053-2.rs:7:39: 7:48]>: Iterator`
38
39 error: aborting due to 2 previous errors
40
41 Some errors have detailed explanations: E0599, E0631.
42 For more information about an error, try `rustc --explain E0599`.