]> git.lizzy.rs Git - rust.git/blob - tests/ui/iterators/invalid-iterator-chain-with-int-infer.stderr
Auto merge of #106773 - Nilstrieb:rollup-sq73pyg, r=Nilstrieb
[rust.git] / tests / ui / iterators / invalid-iterator-chain-with-int-infer.stderr
1 error[E0277]: a value of type `f32` cannot be made by summing an iterator over elements of type `{integer}`
2   --> $DIR/invalid-iterator-chain-with-int-infer.rs:2:41
3    |
4 LL |     let x = Some(()).iter().map(|()| 1).sum::<f32>();
5    |                                         ^^^ value of type `f32` cannot be made by summing a `std::iter::Iterator<Item={integer}>`
6    |
7    = help: the trait `Sum<{integer}>` is not implemented for `f32`
8    = help: the following other types implement trait `Sum<A>`:
9              <f32 as Sum<&'a f32>>
10              <f32 as Sum>
11 note: the method call chain might not have had the expected associated types
12   --> $DIR/invalid-iterator-chain-with-int-infer.rs:2:29
13    |
14 LL |     let x = Some(()).iter().map(|()| 1).sum::<f32>();
15    |             -------- ------ ^^^^^^^^^^^ `Iterator::Item` changed to `{integer}` here
16    |             |        |
17    |             |        `Iterator::Item` is `&()` here
18    |             this expression has type `Option<()>`
19 note: required by a bound in `std::iter::Iterator::sum`
20   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
21
22 error: aborting due to previous error
23
24 For more information about this error, try `rustc --explain E0277`.