Skip to content

Commit f934fa7

Browse files
committed
core::rt: Docs
1 parent 329dfca commit f934fa7

File tree

1 file changed

+61
-13
lines changed

1 file changed

+61
-13
lines changed

src/libcore/rt/mod.rs

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,57 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

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+
*/
1262

1363
#[doc(hidden)];
1464

@@ -20,39 +70,37 @@ pub mod global_heap;
2070
/// The Scheduler and Task types.
2171
mod sched;
2272

23-
/// Thread-local access to the current Scheduler
73+
/// Thread-local access to the current Scheduler.
2474
pub mod local_sched;
2575

26-
/// Synchronous I/O
76+
/// Synchronous I/O.
2777
#[path = "io/mod.rs"]
2878
pub mod io;
2979

30-
/// Thread-local implementations of language-critical runtime features like @
80+
/// Thread-local implementations of language-critical runtime features like @.
3181
pub mod local_services;
3282

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.
3684
mod rtio;
3785

38-
/// libuv
86+
/// libuv and default rtio implementation.
3987
#[path = "uv/mod.rs"]
4088
pub mod uv;
4189

4290
// 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.
4492
pub mod thread_local_storage;
4593

46-
/// A parallel work-stealing queue
94+
/// A parallel work-stealing dequeue.
4795
mod work_queue;
4896

49-
/// Stack segments and their cacheing
97+
/// Stack segments and caching.
5098
mod stack;
5199

52-
/// CPU context swapping
100+
/// CPU context swapping.
53101
mod context;
54102

55-
/// Bindings to system threading libraries
103+
/// Bindings to system threading libraries.
56104
mod thread;
57105

58106
/// The runtime configuration, read from environment variables

0 commit comments

Comments
 (0)