8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
- //! Rust runtime services, including the task scheduler and I/O interface
11
+ /*! The Rust Runtime, including the task scheduler and I/O
12
+
13
+ The `rt` module provides the private runtime infrastructure necessary
14
+ to support core language features like the exchange and local heap,
15
+ the garbage collector, logging, local data and unwinding. It also
16
+ implements the default task scheduler and task model. Initialization
17
+ routines are provided for setting up runtime resources in common
18
+ configurations, including that used by `rustc` when generating
19
+ executables.
20
+
21
+ It is intended that the features provided by `rt` can be factored in a
22
+ way such that the core library can be built with different 'profiles'
23
+ for different use cases, e.g. excluding the task scheduler. A number
24
+ of runtime features though are critical to the functioning of the
25
+ language and an implementation must be provided regardless of the
26
+ execution environment.
27
+
28
+ Of foremost importance is the global exchange heap, in the module
29
+ `global_heap`. Very little practical Rust code can be written without
30
+ access to the global heap. Unlike most of `rt` the global heap is
31
+ truly a global resource and generally operates independently of the
32
+ rest of the runtime.
33
+
34
+ All other runtime features are 'local', either thread-local or
35
+ task-local. Those critical to the functioning of the language are
36
+ defined in the module `local_services`. Local services are those which
37
+ are expected to be available to Rust code generally but rely on
38
+ thread- or task-local state. These currently include the local heap,
39
+ the garbage collector, local storage, logging and the stack unwinder.
40
+ Local services are primarily implemented for tasks, but may also
41
+ be implemented for use outside of tasks.
42
+
43
+ The relationship between `rt` and the rest of the core library is
44
+ not entirely clear yet and some modules will be moving into or
45
+ out of `rt` as development proceeds.
46
+
47
+ Several modules in `core` are clients of `rt`:
48
+
49
+ * `core::task` - The user-facing interface to the Rust task model.
50
+ * `core::task::local_data` - The interface to local data.
51
+ * `core::gc` - The garbage collector.
52
+ * `core::unstable::lang` - Miscellaneous lang items, some of which rely on `core::rt`.
53
+ * `core::condition` - Uses local data.
54
+ * `core::cleanup` - Local heap destruction.
55
+ * `core::io` - In the future `core::io` will use an `rt` implementation.
56
+ * `core::logging`
57
+ * `core::pipes`
58
+ * `core::comm`
59
+ * `core::stackwalk`
60
+
61
+ */
12
62
13
63
#[ doc( hidden) ] ;
14
64
@@ -20,39 +70,37 @@ pub mod global_heap;
20
70
/// The Scheduler and Task types.
21
71
mod sched;
22
72
23
- /// Thread-local access to the current Scheduler
73
+ /// Thread-local access to the current Scheduler.
24
74
pub mod local_sched;
25
75
26
- /// Synchronous I/O
76
+ /// Synchronous I/O.
27
77
#[ path = "io/mod.rs" ]
28
78
pub mod io;
29
79
30
- /// Thread-local implementations of language-critical runtime features like @
80
+ /// Thread-local implementations of language-critical runtime features like @.
31
81
pub mod local_services;
32
82
33
- /// The EventLoop and internal synchronous I/O interface, dynamically
34
- /// overridable so that it's primary implementation on libuv can
35
- /// live outside of core.
83
+ /// The EventLoop and internal synchronous I/O interface.
36
84
mod rtio;
37
85
38
- /// libuv
86
+ /// libuv and default rtio implementation.
39
87
#[ path = "uv/mod.rs" ]
40
88
pub mod uv;
41
89
42
90
// FIXME #5248: The import in `sched` doesn't resolve unless this is pub!
43
- /// Bindings to pthread/windows thread-local storage
91
+ /// Bindings to pthread/windows thread-local storage.
44
92
pub mod thread_local_storage;
45
93
46
- /// A parallel work-stealing queue
94
+ /// A parallel work-stealing dequeue.
47
95
mod work_queue;
48
96
49
- /// Stack segments and their cacheing
97
+ /// Stack segments and caching.
50
98
mod stack;
51
99
52
- /// CPU context swapping
100
+ /// CPU context swapping.
53
101
mod context;
54
102
55
- /// Bindings to system threading libraries
103
+ /// Bindings to system threading libraries.
56
104
mod thread;
57
105
58
106
/// The runtime configuration, read from environment variables
0 commit comments