Created
April 18, 2019 18:51
-
-
Save jacoby/7958d44c15e639c4a3d80d55524f1f84 to your computer and use it in GitHub Desktop.
code and error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiling yafpl v0.1.0 (/home/jacoby/local/dev/rusty_world/yafpl) | |
error[E0308]: mismatched types | |
--> src/main.rs:29:32 | |
| | |
29 | recurse_magic_box(&numbers,&this_is_mutable_motherfucker,0); | |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability | |
| | |
= note: expected type `&mut [i32]` | |
found type `&[i32; 9]` | |
error: aborting due to previous error | |
For more information about this error, try `rustc --explain E0308`. | |
error: Could not compile `yafpl`. | |
To learn more, run the command again with --verbose. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn recurse_magic_box ( numbers: &[i32] , mut this_is_mutable_motherfucker: &mut [i32] , i: i32 ) { | |
this_is_mutable_motherfucker[0] = 0; | |
println!("NUM {}", numbers[0] ); | |
println!("this_is_mutable_motherfucker {:?}", this_is_mutable_motherfucker ); | |
println!("INDEX {}",i); | |
if i < 9 { | |
this_is_mutable_motherfucker[0] = 0; | |
// recurse_magic_box( &numbers,&this_is_mutable_motherfucker,i+1); | |
// for n in numbers { | |
// println!(" {:?}", this_is_mutable_motherfucker ); | |
// println!(" {}",n); | |
// } | |
} | |
// if numbers.len() > 1 { | |
// array.extend(&numbers[0]); | |
// println!("[]",array); | |
// recurse_magic_box( &numbers[1..numbers.len()], &array ); | |
// } | |
} | |
fn main() { | |
println!("ZED"); | |
let numbers: [i32;9] = [3,4,5,6,7,8,9,10,11]; | |
let mut this_is_mutable_motherfucker: [i32;9] = [0,0,0,0,0,0,0,0,0]; | |
this_is_mutable_motherfucker[0] = 0; | |
// let index = 0 ; | |
// recurse_magic_box(&numbers,&this_is_mutable_motherfucker,index); | |
recurse_magic_box(&numbers,&this_is_mutable_motherfucker,0); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment