Skip to content

Commit 6fa4287

Browse files
committed
---
yaml --- r: 35316 b: refs/heads/master c: 38ba2c4 h: refs/heads/master v: v3
1 parent 03a3fd8 commit 6fa4287

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: b52a4b412e515620c2c3ccbe8b7f8c7e0300f6ff
2+
refs/heads/master: 38ba2c4941ede8d999a0208c50f1ad077ba259da
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024

trunk/src/libcore/kinds.rs

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,35 @@
1-
//! The kind traits
1+
/*!
2+
The kind traits
23
3-
#[lang="const"]
4-
pub trait Const {
5-
// Empty.
6-
}
4+
Rust types can be classified in vairous useful ways according to
5+
intrinsic properties of the type. These classifications, often called
6+
'kinds', are represented as traits.
7+
8+
They cannot be implemented by user code, but are instead implemented
9+
by the compiler automatically for the types to which they apply.
10+
11+
The 4 kinds are
12+
13+
* Copy - types that may be copied without allocation. This includes
14+
scalar types and managed pointers, and exludes owned pointers. It
15+
also excludes types that implement `Drop`.
16+
17+
* Send - owned types and types containing owned types. These types
18+
may be transferred across task boundaries.
19+
20+
* Const - types that are deeply immutable. Const types are used for
21+
freezable data structures.
22+
23+
* Owned - types that do not contain borrowed pointers. Note that this
24+
meaning of 'owned' conflicts with 'owned pointers'. The two notions
25+
of ownership are different.
26+
27+
`Copy` types include both implicitly copyable types that the compiler
28+
will copy automatically and non-implicitly copyable types that require
29+
the `copy` keyword to copy. Types that do not implement `Copy` may
30+
instead implement `Clone`.
31+
32+
*/
733

834
#[lang="copy"]
935
pub trait Copy {
@@ -15,6 +41,11 @@ pub trait Send {
1541
// Empty.
1642
}
1743

44+
#[lang="const"]
45+
pub trait Const {
46+
// Empty.
47+
}
48+
1849
#[lang="owned"]
1950
pub trait Owned {
2051
// Empty.

0 commit comments

Comments
 (0)