SP
Size: a a a
SP
OA
OA
А
D
ΑZ
rust
fn main() {
let x;
x = 5;
println!("{}", x);
}5
SP
rust
fn main() {
let x;
x = 5;
println!("{}", x);
}5
ΑZ
SP
ΑZ
rust
fn main() {
let x: i32;
println!("{}", x);
}error[E0381]: borrow of possibly-uninitialized variable: `x`
--> 1126219676/source.rs:3:18
|
3 | println!("{}", x);
| ^ use of possibly-uninitialized `x`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0381`.
SP
ΑZ
rust
fn main() {
let x;
x = 5;
x = 6;
println!("{}", x);
}warning: value assigned to `x` is never read
--> 962966187/source.rs:3:3
|
3 | x = 5;
| ^
|
= note: `#[warn(unused_assignments)]` on by default
= help: maybe it is overwritten before being read?
error[E0384]: cannot assign twice to immutable variable `x`
--> 962966187/source.rs:4:3
|
2 | let x;
| - help: make this binding mutable: `mut x`
3 | x = 5;
| ----- first assignment to `x`
4 | x = 6;
| ^^^^^ cannot assign twice to immutable variable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0384`.
ΑZ
immutable variable `x` ?SP
ΑZ
ΑZ
SP
ΑZ
OA
А