|
|
@ -88,7 +88,7 @@ However, `bar_cloned` actually has type `&Container<T>`. Surely this doesn't mak
|
|
|
|
sense - we added `#[derive(Clone)]` to `Container`, so it must implement `Clone`!
|
|
|
|
sense - we added `#[derive(Clone)]` to `Container`, so it must implement `Clone`!
|
|
|
|
Looking closer, the code generated by the `derive` macro is (roughly):
|
|
|
|
Looking closer, the code generated by the `derive` macro is (roughly):
|
|
|
|
|
|
|
|
|
|
|
|
```rust.ignore
|
|
|
|
```rust,ignore
|
|
|
|
impl<T> Clone for Container<T> where T: Clone {
|
|
|
|
impl<T> Clone for Container<T> where T: Clone {
|
|
|
|
fn clone(&self) -> Self {
|
|
|
|
fn clone(&self) -> Self {
|
|
|
|
Self(Arc::clone(&self.0))
|
|
|
|
Self(Arc::clone(&self.0))
|
|
|
|