summaryrefslogblamecommitdiffstats
path: root/examples/16_borrow-error.rs
blob: eefe233c78479e60a6ed7497842f62f4fa8fe7f6 (plain) (tree)
1
2
3
4
5
6
7
8
9
10









                       
fn foo () -> &int {
    let x = 2;
    return &x;
}

fn main () {
    let x = foo();
    println!("{}", *x);
}