|
152 | 152 | //! contains further primitive shared memory types, including [`atomic`] and
|
153 | 153 | //! [`mpsc`], which contains the channel types for message passing.
|
154 | 154 | //!
|
| 155 | +//! # Use before and after `main()` |
| 156 | +//! |
| 157 | +//! Many parts of the standard library are expected to work before and after `main()`; |
| 158 | +//! but this is not guaranteed or ensured by tests. It is recommended that you write your own tests |
| 159 | +//! and run them on each platform you wish to support. |
| 160 | +//! This means that use of `std` before/after main, especially of features that interact with the |
| 161 | +//! OS or global state, is exempted from stability and portability guarantees and instead only |
| 162 | +//! provided on a best-effort basis. Nevertheless bug reports are appreciated. |
| 163 | +//! |
| 164 | +//! On the other hand `core` and `alloc` are most likely to work in such environments with |
| 165 | +//! the caveat that any hookable behavior such as panics, oom handling or allocators will also |
| 166 | +//! depend on the compatibility of the hooks. |
| 167 | +//! |
| 168 | +//! Some features may also behave differently outside main, e.g. stdio could become unbuffered, |
| 169 | +//! some panics might turn into aborts, backtraces might not get symbolicated or similar. |
| 170 | +//! |
| 171 | +//! Non-exhaustive list of known limitations: |
| 172 | +//! |
| 173 | +//! - after-main use of thread-locals, which also affects additional features: |
| 174 | +//! - [`thread::current()`] |
| 175 | +//! - [`thread::scope()`] |
| 176 | +//! - [`sync::mpsc`] |
| 177 | +//! - before-main stdio file descriptors are not guaranteed to be open on unix platforms |
| 178 | +//! |
| 179 | +//! |
155 | 180 | //! [I/O]: io
|
156 | 181 | //! [`MIN`]: i32::MIN
|
157 | 182 | //! [`MAX`]: i32::MAX
|
|
187 | 212 | //! [rust-discord]: https://discord.gg/rust-lang
|
188 | 213 | //! [array]: prim@array
|
189 | 214 | //! [slice]: prim@slice
|
190 |
| -
|
191 | 215 | // To run std tests without x.py without ending up with two copies of std, Miri needs to be
|
192 | 216 | // able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>.
|
193 | 217 | // rustc itself never sets the feature, so this line has no effect there.
|
|
0 commit comments