@cmr: Not much of a discussion there. I don't see any resolution, just kimundi saying that `&T` gets cloned to `&T`.

However, it seems to me that doing a shallow clone in the non-owning case is unsafe. If I have a function `fn foo(f: |c: &CString|)` and it calls the closure with a non-owned CString, the closure can make a clone of that and store it somewhere accessible from outside the closure. Then when the closure returns, the underlying buffer may be freed, or reused, or whatever else, but my code still has access to it via the clone.

```rust
fn foo(f: |c: &CString|) {
    let s = ~"test";
    let c = s.to_c_str();
    // give the closure a non-owned CString
    let mut c_ = c.with_ref(|c| unsafe { CString::new(c, false) } );
    f(&c_);
    // muck with the buffer for later printing
    c_.with_mut_ref(|c| unsafe { *c = 'X' as libc::c_char } );
}

fn main() {
    let mut c_: Option<CString> = None;
    foo(|c| {
        c_ = Some(c.clone());
        println!("cstr: {:?}", c.as_bytes());
    });
    let c_ = c_.unwrap();
    println!("c_: {:?}", c_.as_bytes());
}
```