Skip to content

Commit dff8f2c

Browse files
committed
---
yaml --- r: 205247 b: refs/heads/tmp c: 4b5b966 h: refs/heads/master i: 205245: b79692d 205243: b479439 205239: a4c569b 205231: e7f13a4 205215: 8f33d13 205183: 42a1261 v: v3
1 parent e9a5e48 commit dff8f2c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+926
-2384
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3232
refs/heads/beta: a59de37e99060162a2674e3ff45409ac73595c0e
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35-
refs/heads/tmp: 522ee203e0fc9ae086a6bc1a14c3bac3d76edea2
35+
refs/heads/tmp: 4b5b9668e0f13cb4cda51b06c098d4b34f86c1c5
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: c2b30b86df6b34ba19e87e63402e43d9e81a64fb
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

branches/tmp/AUTHORS.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,6 @@ Rob Hoelz <[email protected]>
736736
Robert Buonpastore <[email protected]>
737737
Robert Clipsham <[email protected]>
738738
Robert Gawdzik <[email protected]>
739-
Robert Foss <[email protected]>
740739
Robert Irelan <[email protected]>
741740
Robert Knight <[email protected]>
742741
Robert Millar <[email protected]>

branches/tmp/src/doc/reference.md

Lines changed: 7 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,8 +1346,6 @@ vtable when the trait is used as a [trait object](#trait-objects).
13461346
Traits are implemented for specific types through separate
13471347
[implementations](#implementations).
13481348

1349-
Consider the following trait:
1350-
13511349
```
13521350
# type Surface = i32;
13531351
# type BoundingBox = i32;
@@ -1362,20 +1360,6 @@ This defines a trait with two methods. All values that have
13621360
`draw` and `bounding_box` methods called, using `value.bounding_box()`
13631361
[syntax](#method-call-expressions).
13641362

1365-
Traits can include default implementations of methods, as in:
1366-
1367-
```
1368-
trait Foo {
1369-
fn bar(&self);
1370-
1371-
fn baz(&self) { println!("We called baz."); }
1372-
}
1373-
```
1374-
1375-
Here the `baz` method has a default implementation, so types that implement
1376-
`Foo` need only implement `bar`. It is also possible for implementing types
1377-
to override a method that has a default implementation.
1378-
13791363
Type parameters can be specified for a trait to make it generic. These appear
13801364
after the trait name, using the same syntax used in [generic
13811365
functions](#generic-functions).
@@ -1388,30 +1372,6 @@ trait Seq<T> {
13881372
}
13891373
```
13901374

1391-
It is also possible to define associated types for a trait. Consider the
1392-
following example of a `Container` trait. Notice how the type is available
1393-
for use in the method signatures:
1394-
1395-
```
1396-
trait Container {
1397-
type E;
1398-
fn empty() -> Self;
1399-
fn insert(&mut self, Self::E);
1400-
}
1401-
```
1402-
1403-
In order for a type to implement this trait, it must not only provide
1404-
implementations for every method, but it must specify the type `E`. Here's
1405-
an implementation of `Container` for the standard library type `Vec`:
1406-
1407-
```
1408-
impl<T> Container for Vec<T> {
1409-
type E = T;
1410-
fn empty() -> Vec<T> { Vec::new() }
1411-
fn insert(&mut self, x: T) { self.push(x); }
1412-
}
1413-
```
1414-
14151375
Generic functions may use traits as _bounds_ on their type parameters. This
14161376
will have two effects: only types that have the trait may instantiate the
14171377
parameter, and within the generic function, the methods of the trait can be
@@ -3510,21 +3470,13 @@ more of the closure traits:
35103470

35113471
### Trait objects
35123472

3513-
In Rust, a type like `&SomeTrait` or `Box<SomeTrait>` is called a _trait object_.
3514-
Each instance of a trait object includes:
3515-
3516-
- a pointer to an instance of a type `T` that implements `SomeTrait`
3517-
- a _virtual method table_, often just called a _vtable_, which contains, for
3518-
each method of `SomeTrait` that `T` implements, a pointer to `T`'s
3519-
implementation (i.e. a function pointer).
3520-
3521-
The purpose of trait objects is to permit "late binding" of methods. A call to
3522-
a method on a trait object is only resolved to a vtable entry at compile time.
3523-
The actual implementation for each vtable entry can vary on an object-by-object
3524-
basis.
3525-
3526-
Note that for a trait object to be instantiated, the trait must be
3527-
_object-safe_. Object safety rules are defined in [RFC 255][rfc255].
3473+
Every trait item (see [traits](#traits)) defines a type with the same name as
3474+
the trait. This type is called the _trait object_ of the trait. Trait objects
3475+
permit "late binding" of methods, dispatched using _virtual method tables_
3476+
("vtables"). Whereas most calls to trait methods are "early bound" (statically
3477+
resolved) to specific implementations at compile time, a call to a method on an
3478+
trait objects is only resolved to a vtable entry at compile time. The actual
3479+
implementation for each vtable entry can vary on an object-by-object basis.
35283480

35293481
Given a pointer-typed expression `E` of type `&T` or `Box<T>`, where `T`
35303482
implements trait `R`, casting `E` to the corresponding pointer type `&R` or

branches/tmp/src/doc/trpl/dining-philosophers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ which blocks execution until the thread has completed execution. This ensures
450450
that the threads complete their work before the program exits.
451451

452452
If you run this program, you’ll see that the philosophers eat out of order!
453-
We have mult-threading!
453+
We have multi-threading!
454454

455455
```text
456456
Gilles Deleuze is eating.

branches/tmp/src/liballoc/boxed.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ use core::ops::{Deref, DerefMut};
6262
use core::ptr::{Unique};
6363
use core::raw::{TraitObject};
6464

65-
#[cfg(not(stage0))]
66-
use core::marker::Unsize;
67-
#[cfg(not(stage0))]
68-
use core::ops::CoerceUnsized;
69-
7065
/// A value that represents the heap. This is the default place that the `box`
7166
/// keyword allocates into when no place is supplied.
7267
///
@@ -395,6 +390,3 @@ impl<'a,A,R> FnOnce<A> for Box<FnBox<A,Output=R>+Send+'a> {
395390
self.call_box(args)
396391
}
397392
}
398-
399-
#[cfg(not(stage0))]
400-
impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}

0 commit comments

Comments
 (0)