rollup merge of #23860: nikomatsakis/copy-requires-clone
Conflicts: src/test/compile-fail/coherence-impls-copy.rs
This commit is contained in:
commit
f92e7abefd
224 changed files with 624 additions and 583 deletions
|
|
@ -1648,7 +1648,7 @@ specific type.
|
|||
Implementations are defined with the keyword `impl`.
|
||||
|
||||
```
|
||||
# #[derive(Copy)]
|
||||
# #[derive(Copy, Clone)]
|
||||
# struct Point {x: f64, y: f64};
|
||||
# type Surface = i32;
|
||||
# struct BoundingBox {x: f64, y: f64, width: f64, height: f64};
|
||||
|
|
@ -1661,6 +1661,10 @@ struct Circle {
|
|||
|
||||
impl Copy for Circle {}
|
||||
|
||||
impl Clone for Circle {
|
||||
fn clone(&self) -> Circle { *self }
|
||||
}
|
||||
|
||||
impl Shape for Circle {
|
||||
fn draw(&self, s: Surface) { do_draw_circle(s, *self); }
|
||||
fn bounding_box(&self) -> BoundingBox {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue