fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.3 KiB26 linesraw
1error[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:47
3   |
4LL |     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   |                                         required by a bound introduced by this call
8   |
9   = help: the trait `Sum<{integer}>` is not implemented for `f32`
10   = help: the following other types implement trait `Sum<A>`:
11             <f32 as Sum>
12             <f32 as Sum<&'a f32>>
13note: the method call chain might not have had the expected associated types
14  --> $DIR/invalid-iterator-chain-with-int-infer.rs:2:29
15   |
16LL |     let x = Some(()).iter().map(|()| 1).sum::<f32>();
17   |             -------- ------ ^^^^^^^^^^^ `Iterator::Item` changed to `{integer}` here
18   |             |        |
19   |             |        `Iterator::Item` is `&()` here
20   |             this expression has type `Option<()>`
21note: required by a bound in `std::iter::Iterator::sum`
22  --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
23
24error: aborting due to previous error
25
26For more information about this error, try `rustc --explain E0277`.