fork/rust

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

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

master
1.3 KiB24 linesraw
1error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified
2  --> $DIR/trait-hidden-method.rs:6:33
3   |
4LL |     Box::new(1..=10) as Box<dyn Iterator>
5   |                                 ^^^^^^^^ help: specify the associated type: `Iterator<Item = Type>`
6
7error[E0271]: expected `Box<dyn Iterator>` to be an iterator that yields `u32`, but it yields `<dyn Iterator as Iterator>::Item`
8  --> $DIR/trait-hidden-method.rs:3:32
9   |
10LL | pub fn i_can_has_iterator() -> impl Iterator<Item = u32> {
11   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found `u32`
12...
13LL |     Box::new(1..=10) as Box<dyn Iterator>
14   |     ------------------------------------- return type was inferred to be `Box<dyn Iterator>` here
15   |
16   = note: expected associated type `<dyn Iterator as Iterator>::Item`
17                         found type `u32`
18   = help: consider constraining the associated type `<dyn Iterator as Iterator>::Item` to `u32` or calling a method that returns `<dyn Iterator as Iterator>::Item`
19   = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
20
21error: aborting due to 2 previous errors
22
23Some errors have detailed explanations: E0191, E0271.
24For more information about an error, try `rustc --explain E0191`.