Rust
The poster child for memory safety
Ownership
fn main() {
let original = "Hello, World!".to_string();
let other = original;
println!("{}", original);
}error[E0382]: borrow of moved value: `original`
--> src/main.rs:4:20
|
2 | let original = "Hello, World!".to_string();
| -------- move occurs because `original` has type `String`, which does not implement the `Copy` trait
3 | let other = original;
| -------- value moved here
4 | println!("{}", original);
| ^^^^^^^^ value borrowed here after moveBorrowing
Immutable Borrowing
Mutable Borrowing
Lifetimes
No Null Pointers
Out of Bounds
Last updated
Was this helpful?