Skip to content

Commit 859d295

Browse files
committed
Auto merge of #27557 - Manishearth:rollup, r=Manishearth
- Successful merges: #27546, #27550 - Failed merges:
2 parents b81ab8a + 4e9300c commit 859d295

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/doc/reference.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,29 @@ have an implementation for `Shape`. Multiple supertraits are separated by `+`,
15011501
`trait Circle : Shape + PartialEq { }`. In an implementation of `Circle` for a
15021502
given type `T`, methods can refer to `Shape` methods, since the typechecker
15031503
checks that any type with an implementation of `Circle` also has an
1504-
implementation of `Shape`.
1504+
implementation of `Shape`:
1505+
1506+
```rust
1507+
struct Foo;
1508+
1509+
trait Shape { fn area(&self) -> f64; }
1510+
trait Circle : Shape { fn radius(&self) -> f64; }
1511+
# impl Shape for Foo {
1512+
# fn area(&self) -> f64 {
1513+
# 0.0
1514+
# }
1515+
# }
1516+
impl Circle for Foo {
1517+
fn radius(&self) -> f64 {
1518+
println!("calling area: {}", self.area());
1519+
1520+
0.0
1521+
}
1522+
}
1523+
1524+
let c = Foo;
1525+
c.radius();
1526+
```
15051527

15061528
In type-parameterized functions, methods of the supertrait may be called on
15071529
values of subtrait-bound type parameters. Referring to the previous example of

src/libstd/fs.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,8 @@ pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()>
855855
/// Note that if `from` and `to` both point to the same file, then the file
856856
/// will likely get truncated by this operation.
857857
///
858+
/// On success, the total number of bytes copied is returned.
859+
///
858860
/// # Errors
859861
///
860862
/// This function will return an error in the following situations, but is not

0 commit comments

Comments
 (0)