docs: reiterate that [build] doesn't go in Cargo.toml (#6728)

To enable unstable features in Tokio, passing `--cfg tokio_unstable` to
the compiler is necessary. We document how to do this in a variety of
ways in the main Tokio (lib.rs) documentation.

One way is to add a `[build]` section to the file `.cargo/config.toml`.
Even though this filename is stated in the documentation, it is quite
common that first time users (including this author, some time ago) put
it in their `Cargo.toml` file instead.

This change adds a "warning" section to the documentation to reiterate
the point that this section doesn't go in the cargo manifest
(`Cargo.toml`).
This commit is contained in:
Hayden Stainsby 2024-07-29 11:23:29 +02:00 committed by GitHub
parent ebda4c3d3f
commit 04c2718508
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -367,6 +367,12 @@
//! rustflags = ["--cfg", "tokio_unstable"]
//! ```
//!
//! <div class="warning">
//! The <code>[build]</code> section does <strong>not</strong> go in a
//! <code>Cargo.toml</code> file. Instead it must be placed in the Cargo config
//! file <code>.cargo/config.toml</code>.
//! </div>
//!
//! Alternatively, you can specify it with an environment variable:
//!
//! ```sh