Auto merge of #27557 - Manishearth:rollup, r=Manishearth

- Successful merges: #27546, #27550
- Failed merges:
This commit is contained in:
bors 2015-08-06 06:59:19 +00:00
commit 859d2954ed
2 changed files with 25 additions and 1 deletions

View File

@ -1501,7 +1501,29 @@ have an implementation for `Shape`. Multiple supertraits are separated by `+`,
`trait Circle : Shape + PartialEq { }`. In an implementation of `Circle` for a `trait Circle : Shape + PartialEq { }`. In an implementation of `Circle` for a
given type `T`, methods can refer to `Shape` methods, since the typechecker given type `T`, methods can refer to `Shape` methods, since the typechecker
checks that any type with an implementation of `Circle` also has an checks that any type with an implementation of `Circle` also has an
implementation of `Shape`. implementation of `Shape`:
```rust
struct Foo;
trait Shape { fn area(&self) -> f64; }
trait Circle : Shape { fn radius(&self) -> f64; }
# impl Shape for Foo {
# fn area(&self) -> f64 {
# 0.0
# }
# }
impl Circle for Foo {
fn radius(&self) -> f64 {
println!("calling area: {}", self.area());
0.0
}
}
let c = Foo;
c.radius();
```
In type-parameterized functions, methods of the supertrait may be called on In type-parameterized functions, methods of the supertrait may be called on
values of subtrait-bound type parameters. Referring to the previous example of values of subtrait-bound type parameters. Referring to the previous example of

View File

@ -855,6 +855,8 @@ pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()>
/// Note that if `from` and `to` both point to the same file, then the file /// Note that if `from` and `to` both point to the same file, then the file
/// will likely get truncated by this operation. /// will likely get truncated by this operation.
/// ///
/// On success, the total number of bytes copied is returned.
///
/// # Errors /// # Errors
/// ///
/// This function will return an error in the following situations, but is not /// This function will return an error in the following situations, but is not