Tibet does not have a space program. Peru does.
This commit is contained in:
parent
4805e1291a
commit
69095bb023
1 changed files with 8 additions and 8 deletions
|
@ -3651,23 +3651,23 @@ specialized further. Erroneous code example:
|
|||
```compile_fail
|
||||
#![feature(specialization)]
|
||||
|
||||
trait SpaceLama {
|
||||
trait SpaceLlama {
|
||||
fn fly(&self);
|
||||
}
|
||||
|
||||
// applies to all T
|
||||
impl<T> SpaceLama for T {
|
||||
impl<T> SpaceLlama for T {
|
||||
default fn fly(&self) {}
|
||||
}
|
||||
|
||||
// non-default impl
|
||||
// applies to all `Clone` T and overrides the previous impl
|
||||
impl<T: Clone> SpaceLama for T {
|
||||
impl<T: Clone> SpaceLlama for T {
|
||||
fn fly(&self) {}
|
||||
}
|
||||
|
||||
// since `i32` is clone, this conflicts with the previous implementation
|
||||
impl SpaceLama for i32 {
|
||||
impl SpaceLlama for i32 {
|
||||
default fn fly(&self) {}
|
||||
// error: item `fly` is provided by an `impl` that specializes
|
||||
// another, but the item in the parent `impl` is not marked
|
||||
|
@ -3684,23 +3684,23 @@ Example:
|
|||
```
|
||||
#![feature(specialization)]
|
||||
|
||||
trait SpaceLama {
|
||||
trait SpaceLlama {
|
||||
fn fly(&self);
|
||||
}
|
||||
|
||||
// applies to all T
|
||||
impl<T> SpaceLama for T {
|
||||
impl<T> SpaceLlama for T {
|
||||
default fn fly(&self) {} // This is a parent implementation.
|
||||
}
|
||||
|
||||
// applies to all `Clone` T; overrides the previous impl
|
||||
impl<T: Clone> SpaceLama for T {
|
||||
impl<T: Clone> SpaceLlama for T {
|
||||
default fn fly(&self) {} // This is a parent implementation but was
|
||||
// previously not a default one, causing the error
|
||||
}
|
||||
|
||||
// applies to i32, overrides the previous two impls
|
||||
impl SpaceLama for i32 {
|
||||
impl SpaceLlama for i32 {
|
||||
fn fly(&self) {} // And now that's ok!
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Add table
Reference in a new issue