Repository: tokio-rs/tokio
File: tokio/src/lib.rs (Rust)

Code before:
//!
//!  * `sync`
//!  * `macros`
//!  * `io-util`
//!  * `rt`
//!  * `time`
//!
//! Enabling any other feature (including `full`) will cause a compilation
//! failure.
//!
//! The `time` module will only work on WASM platforms that have support for
//! timers (e.g. wasm32-wasi). The timing functions will panic if used on a WASM
//! platform that does not support timers.
//!
//! Note also that if the runtime becomes indefinitely idle, it will panic
//! immediately instead of blocking forever. On platforms that don't support
//! time, this means that the runtime can never be idle in any way.
//!
//! ### Unstable WASM support
//!
//! Tokio also has unstable support for some additional WASM features. This
//! requires the use of the `tokio_unstable` flag.
//!
//! Using this flag enables the use of `tokio::net` on the wasm32-wasi target.
//! However, not all methods are available on the networking types as WASI
//! currently does not support the creation of new sockets from within wasm.
//! Because of this, sockets must currently be created via the `FromRawFd`
//! trait.

// Test that pointer width is compatible. This asserts that e.g. usize is at
// least 32 bits, which a lot of components in Tokio currently assumes.
//
// TODO: improve once we have MSRV access to const eval to make more flexible.
#[cfg(not(any(
    target_pointer_width = "32",
    target_pointer_width = "64",
    target_pointer_width = "128"
)))]
compile_error! {
    "Tokio requires the platform pointer width to be 32, 64, or 128 bits"
}

// Ensure that our build script has correctly set cfg flags for wasm.
//
// Each condition is written all(a, not(b)). This should be read as
// "if a, then we must also have b".
#[cfg(any(
    all(target_arch = "wasm32", not(tokio_wasm)),
    all(target_arch = "wasm64", not(tokio_wasm)),
    all(target_family = "wasm", not(tokio_wasm)),
    all(target_os = "wasi", not(tokio_wasm)),

Review comment (suggestion):
Capitalize WASM?
```suggestion
//! currently does not support the creation of new sockets from within WASM.
```

Code after:
//!
//!  * `sync`
//!  * `macros`
//!  * `io-util`
//!  * `rt`
//!  * `time`
//!
//! Enabling any other feature (including `full`) will cause a compilation
//! failure.
//!
//! The `time` module will only work on WASM platforms that have support for
//! timers (e.g. wasm32-wasi). The timing functions will panic if used on a WASM
//! platform that does not support timers.
//!
//! Note also that if the runtime becomes indefinitely idle, it will panic
//! immediately instead of blocking forever. On platforms that don't support
//! time, this means that the runtime can never be idle in any way.
//!
//! ### Unstable WASM support
//!
//! Tokio also has unstable support for some additional WASM features. This
//! requires the use of the `tokio_unstable` flag.
//!
//! Using this flag enables the use of `tokio::net` on the wasm32-wasi target.
//! However, not all methods are available on the networking types as WASI
//! currently does not support the creation of new sockets from within WASM.
//! Because of this, sockets must currently be created via the `FromRawFd`
//! trait.

// Test that pointer width is compatible. This asserts that e.g. usize is at
// least 32 bits, which a lot of components in Tokio currently assumes.
//
// TODO: improve once we have MSRV access to const eval to make more flexible.
#[cfg(not(any(
    target_pointer_width = "32",
    target_pointer_width = "64",
    target_pointer_width = "128"
)))]
compile_error! {
    "Tokio requires the platform pointer width to be 32, 64, or 128 bits"
}

// Ensure that our build script has correctly set cfg flags for wasm.
//
// Each condition is written all(a, not(b)). This should be read as
// "if a, then we must also have b".
#[cfg(any(
    all(target_arch = "wasm32", not(tokio_wasm)),
    all(target_arch = "wasm64", not(tokio_wasm)),
    all(target_family = "wasm", not(tokio_wasm)),
    all(target_os = "wasi", not(tokio_wasm)),