mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
10 lines
257 B
Rust
10 lines
257 B
Rust
struct FancyNum {
|
|
num: u8,
|
|
}
|
|
|
|
fn main() {
|
|
let mut fancy = FancyNum{ num: 5 };
|
|
let fancy_ref = &(&mut fancy);
|
|
fancy_ref.num = 6; //~ ERROR cannot assign to `fancy_ref.num`, which is behind a `&` reference
|
|
println!("{}", fancy_ref.num);
|
|
}
|