error: expected `;`, found keyword `for`
--> /w/foo.rs:30:3
|
30 | }
| ^ help: add `;` here
31 | for i in (0 .. left_node_start_index).rev() {
| --- unexpected token
error[E0425]: cannot find function `min` in this scope
--> /w/foo.rs:44:23
|
8 | fn main() -> Result<(), Box<dyn Error>> {
| --------------------------------------- similarly named function `main` defined here
...
44 | if a[i].unwrap() < min(a[gl(i)].unwrap(), a[gr(i)].unwrap()) {
| ^^^
|
help: a function with a similar name exists
|
44 | if a[i].unwrap() < main(a[gl(i)].unwrap(), a[gr(i)].unwrap()) {
| ~~~~
help: consider importing this function
|
2 | use std::cmp::min;
|
error[E0425]: cannot find function `max` in this scope
--> /w/foo.rs:54:29
|
54 | }else if a[i].unwrap() < max(a[gl(i)].unwrap(), a[gr(i)].unwrap()) {
| ^^^ not found in this scope
|
help: consider importing this function
|
2 | use std::cmp::max;
|
error[E0599]: `Vec<i32>` is not an iterator
--> /w/foo.rs:15:16
|
15 | let mut a = a.map(|x| Some(x)).collect::<Vec<Option<i32>>>();
| ^^^ `Vec<i32>` is not an iterator; try calling `.into_iter()` or `.iter()`
|
= note: the following trait bounds were not satisfied:
`Vec<i32>: Iterator`
which is required by `&mut Vec<i32>: Iterator`
`[i32]: Iterator`
which is required by `&mut [i32]: Iterator`
error[E0308]: mismatched types
--> /w/foo.rs:21:13
|
21 | sift_down(a, 0);
| --------- ^
| | |
| | expected mutable reference, found struct `Vec`
| | help: consider mutably borrowing here: `&mut a`
| arguments to this function are incorrect
|
= note: expected mutable reference `&mut Vec<Option<i32>>`
found struct `Vec<Option<i32>>`
note: function defined here
--> /w/foo.rs:38:4
|
38 | fn sift_down(a:&mut Vec<Option<i32>>,mut i: usize) {
| ^^^^^^^^^ ----------------------- ------------
error[E0308]: mismatched types
--> /w/foo.rs:35:17
|
35 | fn gl(i:usize) {(i+1)*2 -1}
| -^^^^^^^^^^ expected `()`, found `usize`
| |
| help: try adding a return type: `-> usize`
error[E0308]: mismatched types
--> /w/foo.rs:36:17
|
36 | fn gr(i:usize) {(i+1) * 2}
| -^^^^^^^^^ expected `()`, found `usize`
| |
| help: try adding a return type: `-> usize`
error[E0308]: mismatched types
--> /w/foo.rs:37:17
|
37 | fn gf(i:usize) {(i+1)/2 -1}
| -^^^^^^^^^^ expected `()`, found `usize`
| |
| help: try adding a return type: `-> usize`
error[E0308]: mismatched types
--> /w/foo.rs:42:14
|
42 | if gr(i) < a.len() && a[gr(i)].is_some() {
| ^^^^^^^ expected `()`, found `usize`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:42:27
|
42 | if gr(i) < a.len() && a[gr(i)].is_some() {
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:44:29
|
44 | if a[i].unwrap() < min(a[gl(i)].unwrap(), a[gr(i)].unwrap()) {
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:44:48
|
44 | if a[i].unwrap() < min(a[gl(i)].unwrap(), a[gr(i)].unwrap()) {
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:46:10
|
46 | if a[gl(i)].unwrap() > a[gr(i)].unwrap() {
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:46:30
|
46 | if a[gl(i)].unwrap() > a[gr(i)].unwrap() {
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:47:34
|
47 | [a[gl(i)], a[i]] = [a[i], a[gl(i)]];
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:47:9
|
47 | [a[gl(i)], a[i]] = [a[i], a[gl(i)]];
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0308]: mismatched types
--> /w/foo.rs:48:9
|
38 | fn sift_down(a:&mut Vec<Option<i32>>,mut i: usize) {
| ----- expected due to this parameter type
...
48 | i = gl(i);
| ^^^^^ expected `usize`, found `()`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:50:34
|
50 | [a[gr(i)], a[i]] = [a[i], a[gr(i)]];
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:50:9
|
50 | [a[gr(i)], a[i]] = [a[i], a[gr(i)]];
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0308]: mismatched types
--> /w/foo.rs:51:9
|
38 | fn sift_down(a:&mut Vec<Option<i32>>,mut i: usize) {
| ----- expected due to this parameter type
...
51 | i = gr(i);
| ^^^^^ expected `usize`, found `()`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:54:35
|
54 | }else if a[i].unwrap() < max(a[gl(i)].unwrap(), a[gr(i)].unwrap()) {
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:54:54
|
54 | }else if a[i].unwrap() < max(a[gl(i)].unwrap(), a[gr(i)].unwrap()) {
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:56:10
|
56 | if a[gl(i)].unwrap() > a[gr(i)].unwrap() {
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:56:30
|
56 | if a[gl(i)].unwrap() > a[gr(i)].unwrap() {
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:57:34
|
57 | [a[gl(i)], a[i]] = [a[i], a[gl(i)]];
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:57:9
|
57 | [a[gl(i)], a[i]] = [a[i], a[gl(i)]];
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0308]: mismatched types
--> /w/foo.rs:58:9
|
38 | fn sift_down(a:&mut Vec<Option<i32>>,mut i: usize) {
| ----- expected due to this parameter type
...
58 | i = gl(i);
| ^^^^^ expected `usize`, found `()`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:60:34
|
60 | [a[gr(i)], a[i]] = [a[i], a[gr(i)]];
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:60:9
|
60 | [a[gr(i)], a[i]] = [a[i], a[gr(i)]];
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0308]: mismatched types
--> /w/foo.rs:61:9
|
38 | fn sift_down(a:&mut Vec<Option<i32>>,mut i: usize) {
| ----- expected due to this parameter type
...
61 | i = gr(i);
| ^^^^^ expected `usize`, found `()`
error[E0308]: mismatched types
--> /w/foo.rs:66:21
|
66 | } else if gl(i) < a.len() && a[gl(i)].is_some() {
| ^^^^^^^ expected `()`, found `usize`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:66:34
|
66 | } else if gl(i) < a.len() && a[gl(i)].is_some() {
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:68:9
|
68 | if a[gl(i)].unwrap() > a[i].unwrap() {
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:70:33
|
70 | [a[gl(i)], a[i]] = [a[i], a[gl(i)]];
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0277]: the type `[Option<i32>]` cannot be indexed by `()`
--> /w/foo.rs:70:8
|
70 | [a[gl(i)], a[i]] = [a[i], a[gl(i)]];
| ^^^^^ slice indices are of type `usize` or ranges of `usize`
|
= help: the trait `SliceIndex<[Option<i32>]>` is not implemented for `()`
= help: the trait `SliceIndex<[T]>` is implemented for `(Bound<usize>, Bound<usize>)`
= note: required because of the requirements on the impl of `Index<()>` for `Vec<Option<i32>>`
error[E0308]: mismatched types
--> /w/foo.rs:71:9
|
38 | fn sift_down(a:&mut Vec<Option<i32>>,mut i: usize) {
| ----- expected due to this parameter type
...
71 | i = gl(i);
| ^^^^^ expected `usize`, found `()`
error: aborting due to 36 previous errors
Some errors have detailed explanations: E0277, E0308, E0425, E0599.
For more information about an error, try `rustc --explain E0277`.
[Hydro](https://hydro.ac)提供评测服务