String = x; println!("x = {}", x); println!("y = {}", y); } // =================== error[E0382]: use of moved value: `x` --> src/main.rs:5:24 | 3 | let y: String = x; | - value moved here 4 | 5 | println!("x = {}", x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
две"); let ending: &str = "и двеста"; fact.push_str(ending); println!("{}", fact); let also_true: &str = &fact[0..32]; println!("{}", also_true); } // =================== Компилатора знае две и двеста Компилатора знае
= Vec::with_capacity(4); l.push("Roses are #FF0000,"); l.push("Violets are #0000FF"); l.push("Such a boring example"); l.push("What is wrong with you?"); l }; for line in lines { println!("{}", line); } }
b } fn main() { let boring_result = add(3.0, 4.0); println!("Your boring result: {}", boring_result); } // =================== error[E0369]: binary operation `+` cannot be applied to type `T` --> src/main.rs:2:5 | 2 | a + b | ^^^^^ | = note: an implementation of `std::ops::Add` might be missing for `T`
картоф, разрежеш го, а той суров. "; let lines = potato. trim(). lines(). map(|l| l.trim()); println!("---"); for line in lines { println!("{}", line); } println!("---"); } // =================== --- Любов, любов, варен картоф, разрежеш го, а той суров. ---
= File::open("boring.txt"); let mut contents = String::new(); file.read_to_string(&mut contents); println!("{}", contents); } //==================== error[E0599]: no method named `read_to_string` found for type `std::result::Result<std::fs::File, std::io::Error>` in the current scope --> src/main.rs:7:7 | 7 | f.read_to_string(&mut contents); | ^^^^^^^^^^^^^^ error: aborting due to previous error
>= 3 { let filename = args.get(3).unwrap(); run_interpreter(filename) } else { run_console(); } } // =================== thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /checkout/src/libcore/option.rs:335:20 note: Run with `RUST_BACKTRACE=1` for a backtrace.
String = x; println!("x = {}", x); println!("y = {}", y); } // =================== error[E0382]: use of moved value: `x` --> src/main.rs:5:24 | 3 | let y: String = x; | - value moved here 4 | 5 | println!("x = {}", x); | ^ value used here after move | = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait