Skip to content

Commit 44ed9f7

Browse files
committed
---
yaml --- r: 51977 b: refs/heads/dist-snap c: 82641d4 h: refs/heads/master i: 51975: 54ffe2c v: v3
1 parent e6e7996 commit 44ed9f7

File tree

9 files changed

+980
-684
lines changed

9 files changed

+980
-684
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: d6faf23ca3295e4ec691aadc6e5c73f7f9848ae4
10+
refs/heads/dist-snap: 82641d4c39dd547c44c2d2ef4c0c98c5bfbd8b55
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/doc/rust.md

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -876,13 +876,6 @@ fn add(x: int, y: int) -> int {
876876
}
877877
~~~~
878878

879-
As with `let` bindings, function arguments are irrefutable patterns,
880-
so any pattern that is valid in a let binding is also valid as an argument.
881-
882-
~~~
883-
fn first((value, _): (int, int)) -> int { value }
884-
~~~
885-
886879

887880
#### Generic functions
888881

@@ -1229,44 +1222,17 @@ impl float: Num {
12291222
let x: float = Num::from_int(42);
12301223
~~~~
12311224

1232-
Traits may inherit from other traits. For example, in
1225+
Traits can have _constraints_ for example, in
12331226

12341227
~~~~
12351228
trait Shape { fn area() -> float; }
12361229
trait Circle : Shape { fn radius() -> float; }
12371230
~~~~
12381231

12391232
the syntax `Circle : Shape` means that types that implement `Circle` must also have an implementation for `Shape`.
1240-
Multiple supertraits are separated by spaces, `trait Circle : Shape Eq { }`.
12411233
In an implementation of `Circle` for a given type `T`, methods can refer to `Shape` methods,
12421234
since the typechecker checks that any type with an implementation of `Circle` also has an implementation of `Shape`.
12431235

1244-
In type-parameterized functions,
1245-
methods of the supertrait may be called on values of subtrait-bound type parameters.
1246-
Refering to the previous example of `trait Circle : Shape`:
1247-
1248-
~~~
1249-
# trait Shape { fn area() -> float; }
1250-
# trait Circle : Shape { fn radius() -> float; }
1251-
fn radius_times_area<T: Circle>(c: T) -> float {
1252-
// `c` is both a Circle and a Shape
1253-
c.radius() * c.area()
1254-
}
1255-
~~~
1256-
1257-
Likewise, supertrait methods may also be called on trait objects.
1258-
1259-
~~~ {.xfail-test}
1260-
# trait Shape { fn area() -> float; }
1261-
# trait Circle : Shape { fn radius() -> float; }
1262-
# impl int: Shape { fn area() -> float { 0.0 } }
1263-
# impl int: Circle { fn radius() -> float { 0.0 } }
1264-
# let mycircle = 0;
1265-
1266-
let mycircle: Circle = @mycircle as @Circle;
1267-
let nonsense = mycircle.radius() * mycircle.area();
1268-
~~~
1269-
12701236
### Implementations
12711237

12721238
An _implementation_ is an item that implements a [trait](#traits) for a specific type.
@@ -2879,16 +2845,6 @@ The kinds are:
28792845
sendable kind are copyable, as are managed boxes, managed closures,
28802846
trait types, and structural types built out of these.
28812847
Types with destructors (types that implement `Drop`) can not implement `Copy`.
2882-
`Drop`
2883-
: This is not strictly a kind, but its presence interacts with kinds: the `Drop`
2884-
trait provides a single method `finalize` that takes no parameters, and is run
2885-
when values of the type are dropped. Such a method is called a "destructor",
2886-
and are always executed in "top-down" order: a value is completely destroyed
2887-
before any of the values it owns run their destructors. Only `Owned` types
2888-
that do not implement `Copy` can implement `Drop`.
2889-
2890-
> **Note:** The `finalize` method may be renamed in future versions of Rust.
2891-
28922848
_Default_
28932849
: Types with destructors, closure environments,
28942850
and various other _non-first-class_ types,

0 commit comments

Comments
 (0)