diff options
| author | bors <bors@rust-lang.org> | 2015-11-16 19:06:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-11-16 19:06:52 +0000 |
| commit | 99093b79f112c5decd555103c890c6af15ed0c68 (patch) | |
| tree | e45f6f59025ce39c6192da138fe9a40c62f342f9 /src/libstd/sys/unix/stack_overflow.rs | |
| parent | 3042fedb4f50640e2c9a02297c5ce9a1f3ffaa5a (diff) | |
| parent | 67c07d445036e8db7782f3c661a8eb4a70fbe417 (diff) | |
| download | rust-99093b79f112c5decd555103c890c6af15ed0c68.tar.gz rust-99093b79f112c5decd555103c890c6af15ed0c68.zip | |
Auto merge of #29580 - alexbool:smart-pointer-conversion, r=alexcrichton
Sometimes when writing generic code you want to abstract over
owning/pointer type so that calling code isn't restricted by one
concrete owning/pointer type. This commit makes possible such code:
```rust
fn i_will_work_with_arc<T: Into<Arc<MyTy>>>(t: T) {
let the_arc = t.into();
// Do something
}
i_will_work_with_arc(MyTy::new());
i_will_work_with_arc(Box::new(MyTy::new()));
let arc_that_i_already_have = Arc::new(MyTy::new());
i_will_work_with_arc(arc_that_i_already_have);
```
Please note that this patch doesn't work with DSTs.
Also to mention, I made those impls stable, and I don't know whether they should be actually stable from the beginning. Please tell me if this should be feature-gated.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
