|
| 1 | +error[E0599]: `T` is not an iterator |
| 2 | + --> $DIR/method-on-unbounded-type-param.rs:2:7 |
| 3 | + | |
| 4 | +LL | fn f<T>(a: T, b: T) -> std::cmp::Ordering { |
| 5 | + | - method `cmp` not found for this type parameter |
| 6 | +LL | a.cmp(&b) |
| 7 | + | ^^^ `T` is not an iterator |
| 8 | + | |
| 9 | + = note: the following trait bounds were not satisfied: |
| 10 | + `T: Iterator` |
| 11 | + which is required by `&mut T: Iterator` |
| 12 | +help: consider restricting the type parameter to satisfy the trait bound |
| 13 | + | |
| 14 | +LL | fn f<T>(a: T, b: T) -> std::cmp::Ordering where T: Iterator { |
| 15 | + | +++++++++++++++++ |
| 16 | + |
| 17 | +error[E0599]: the method `cmp` exists for reference `&T`, but its trait bounds were not satisfied |
| 18 | + --> $DIR/method-on-unbounded-type-param.rs:5:10 |
| 19 | + | |
| 20 | +LL | (&a).cmp(&b) |
| 21 | + | ^^^ method cannot be called on `&T` due to unsatisfied trait bounds |
| 22 | + | |
| 23 | + = note: the following trait bounds were not satisfied: |
| 24 | + `T: Ord` |
| 25 | + which is required by `&T: Ord` |
| 26 | + `&T: Iterator` |
| 27 | + which is required by `&mut &T: Iterator` |
| 28 | + `T: Iterator` |
| 29 | + which is required by `&mut T: Iterator` |
| 30 | +help: consider restricting the type parameters to satisfy the trait bounds |
| 31 | + | |
| 32 | +LL | fn g<T>(a: T, b: T) -> std::cmp::Ordering where T: Iterator, T: Ord { |
| 33 | + | +++++++++++++++++++++++++ |
| 34 | + |
| 35 | +error[E0599]: the method `cmp` exists for reference `&T`, but its trait bounds were not satisfied |
| 36 | + --> $DIR/method-on-unbounded-type-param.rs:8:7 |
| 37 | + | |
| 38 | +LL | a.cmp(&b) |
| 39 | + | ^^^ method cannot be called on `&T` due to unsatisfied trait bounds |
| 40 | + | |
| 41 | + = note: the following trait bounds were not satisfied: |
| 42 | + `T: Ord` |
| 43 | + which is required by `&T: Ord` |
| 44 | + `&T: Iterator` |
| 45 | + which is required by `&mut &T: Iterator` |
| 46 | + `T: Iterator` |
| 47 | + which is required by `&mut T: Iterator` |
| 48 | +help: consider restricting the type parameters to satisfy the trait bounds |
| 49 | + | |
| 50 | +LL | fn h<T>(a: &T, b: T) -> std::cmp::Ordering where T: Iterator, T: Ord { |
| 51 | + | +++++++++++++++++++++++++ |
| 52 | + |
| 53 | +error[E0599]: the method `cmp` exists for struct `Box<dyn T>`, but its trait bounds were not satisfied |
| 54 | + --> $DIR/method-on-unbounded-type-param.rs:14:7 |
| 55 | + | |
| 56 | +LL | trait T {} |
| 57 | + | ------- |
| 58 | + | | |
| 59 | + | doesn't satisfy `dyn T: Iterator` |
| 60 | + | doesn't satisfy `dyn T: Ord` |
| 61 | +... |
| 62 | +LL | x.cmp(&x); |
| 63 | + | ^^^ method cannot be called on `Box<dyn T>` due to unsatisfied trait bounds |
| 64 | + --> $SRC_DIR/alloc/src/boxed.rs:LL:COL |
| 65 | + ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL |
| 66 | + | |
| 67 | + = note: doesn't satisfy `Box<dyn T>: Iterator` |
| 68 | + | |
| 69 | + = note: doesn't satisfy `Box<dyn T>: Ord` |
| 70 | + | |
| 71 | + = note: the following trait bounds were not satisfied: |
| 72 | + `dyn T: Iterator` |
| 73 | + which is required by `Box<dyn T>: Iterator` |
| 74 | + `dyn T: Ord` |
| 75 | + which is required by `Box<dyn T>: Ord` |
| 76 | + `Box<dyn T>: Iterator` |
| 77 | + which is required by `&mut Box<dyn T>: Iterator` |
| 78 | + `dyn T: Iterator` |
| 79 | + which is required by `&mut dyn T: Iterator` |
| 80 | + |
| 81 | +error: aborting due to 4 previous errors |
| 82 | + |
| 83 | +For more information about this error, try `rustc --explain E0599`. |
0 commit comments