borrowing
Rust Copy a shared reference, not its target
Shared references implement Copy even when their target type does not. Copying one gives another way to inspect the same target. This is different from cloning an owned String. Expected output (not executed): Ada / Ada Why: The two shared references remain usable; the owned String is not duplicated. Common mistake: Assuming &mut T has the same Copy behavior as &T.
Formal Syntax & Structure
rust syntaxrust
let second = first; // first: &TWorking Example
Example Snippetrust
fn main() { let name = String::from("Ada"); let first = &name; let second = first; println!("{first} / {second}");}