mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
ci: run doc tests with miri (#7060)
This commit is contained in:
parent
b3ff911c38
commit
2052938a9f
19
.github/workflows/ci.yml
vendored
19
.github/workflows/ci.yml
vendored
@ -403,6 +403,25 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields
|
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields
|
||||||
|
|
||||||
|
miri-doc-test:
|
||||||
|
name: miri-doc-test
|
||||||
|
needs: basics
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Install Rust ${{ env.rust_miri_nightly }}
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
toolchain: ${{ env.rust_miri_nightly }}
|
||||||
|
components: miri
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
- name: miri-doc-test
|
||||||
|
run: |
|
||||||
|
cargo miri test --doc --all-features --no-fail-fast
|
||||||
|
working-directory: tokio
|
||||||
|
env:
|
||||||
|
MIRIFLAGS: -Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields
|
||||||
|
|
||||||
asan:
|
asan:
|
||||||
name: asan
|
name: asan
|
||||||
needs: basics
|
needs: basics
|
||||||
|
@ -83,6 +83,7 @@ impl TcpListener {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// use tokio::net::TcpListener;
|
/// use tokio::net::TcpListener;
|
||||||
///
|
///
|
||||||
/// use std::io;
|
/// use std::io;
|
||||||
|
@ -743,6 +743,7 @@ impl TcpSocket {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// use tokio::net::TcpSocket;
|
/// use tokio::net::TcpSocket;
|
||||||
/// use socket2::{Domain, Socket, Type};
|
/// use socket2::{Domain, Socket, Type};
|
||||||
///
|
///
|
||||||
|
@ -213,6 +213,7 @@ impl TcpStream {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// use std::error::Error;
|
/// use std::error::Error;
|
||||||
/// use std::io::Read;
|
/// use std::io::Read;
|
||||||
/// use tokio::net::TcpListener;
|
/// use tokio::net::TcpListener;
|
||||||
|
@ -134,6 +134,7 @@ impl UdpSocket {
|
|||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// use tokio::net::UdpSocket;
|
/// use tokio::net::UdpSocket;
|
||||||
/// use std::io;
|
/// use std::io;
|
||||||
///
|
///
|
||||||
@ -295,6 +296,7 @@ impl UdpSocket {
|
|||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// use tokio::net::UdpSocket;
|
/// use tokio::net::UdpSocket;
|
||||||
///
|
///
|
||||||
/// # use std::{io, net::SocketAddr};
|
/// # use std::{io, net::SocketAddr};
|
||||||
@ -1979,6 +1981,7 @@ impl UdpSocket {
|
|||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// use tokio::net::UdpSocket;
|
/// use tokio::net::UdpSocket;
|
||||||
/// use std::io;
|
/// use std::io;
|
||||||
///
|
///
|
||||||
|
@ -35,6 +35,7 @@ cfg_net_unix! {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
/// Using named sockets, associated with a filesystem path:
|
/// Using named sockets, associated with a filesystem path:
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -67,6 +68,7 @@ cfg_net_unix! {
|
|||||||
///
|
///
|
||||||
/// Using unnamed sockets, created as a pair
|
/// Using unnamed sockets, created as a pair
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socketpair` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -371,6 +373,7 @@ impl UnixDatagram {
|
|||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -403,6 +406,7 @@ impl UnixDatagram {
|
|||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No SOCK_DGRAM for socketpair in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -457,6 +461,7 @@ impl UnixDatagram {
|
|||||||
/// explicitly with [`Runtime::enter`](crate::runtime::Runtime::enter) function.
|
/// explicitly with [`Runtime::enter`](crate::runtime::Runtime::enter) function.
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -521,6 +526,7 @@ impl UnixDatagram {
|
|||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -560,6 +566,7 @@ impl UnixDatagram {
|
|||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -604,6 +611,7 @@ impl UnixDatagram {
|
|||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socketpair` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -734,6 +742,7 @@ impl UnixDatagram {
|
|||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socketpair` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -884,6 +893,7 @@ impl UnixDatagram {
|
|||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -1000,6 +1010,7 @@ impl UnixDatagram {
|
|||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socketpair` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -1050,6 +1061,7 @@ impl UnixDatagram {
|
|||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -1100,6 +1112,7 @@ impl UnixDatagram {
|
|||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -1416,6 +1429,7 @@ impl UnixDatagram {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
/// For a socket bound to a local path
|
/// For a socket bound to a local path
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -1438,6 +1452,7 @@ impl UnixDatagram {
|
|||||||
///
|
///
|
||||||
/// For an unbound socket
|
/// For an unbound socket
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -1462,6 +1477,7 @@ impl UnixDatagram {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
/// For a peer with a local path
|
/// For a peer with a local path
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -1487,6 +1503,7 @@ impl UnixDatagram {
|
|||||||
///
|
///
|
||||||
/// For an unbound peer
|
/// For an unbound peer
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socketpair` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -1508,6 +1525,7 @@ impl UnixDatagram {
|
|||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
@ -1535,6 +1553,7 @@ impl UnixDatagram {
|
|||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socketpair` in miri.
|
||||||
/// # use std::error::Error;
|
/// # use std::error::Error;
|
||||||
/// # #[tokio::main]
|
/// # #[tokio::main]
|
||||||
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
/// # async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
|
@ -833,6 +833,7 @@ impl UnixStream {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `socket` in miri.
|
||||||
/// use std::error::Error;
|
/// use std::error::Error;
|
||||||
/// use std::io::Read;
|
/// use std::io::Read;
|
||||||
/// use tokio::net::UnixListener;
|
/// use tokio::net::UnixListener;
|
||||||
|
@ -810,6 +810,7 @@ impl Command {
|
|||||||
/// Basic usage:
|
/// Basic usage:
|
||||||
///
|
///
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
|
/// # if cfg!(miri) { return } // No `pidfd_spawnp` in miri.
|
||||||
/// use tokio::process::Command;
|
/// use tokio::process::Command;
|
||||||
///
|
///
|
||||||
/// async fn run_ls() -> std::process::ExitStatus {
|
/// async fn run_ls() -> std::process::ExitStatus {
|
||||||
@ -1192,6 +1193,7 @@ impl Child {
|
|||||||
/// This function is cancel safe.
|
/// This function is cancel safe.
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // No `pidfd_spawnp` in miri.
|
||||||
/// # #[cfg(not(unix))]fn main(){}
|
/// # #[cfg(not(unix))]fn main(){}
|
||||||
/// # #[cfg(unix)]
|
/// # #[cfg(unix)]
|
||||||
/// use tokio::io::AsyncWriteExt;
|
/// use tokio::io::AsyncWriteExt;
|
||||||
|
@ -421,6 +421,7 @@ impl Runtime {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # if cfg!(miri) { return } // Miri reports error when main thread terminated without waiting all remaining threads.
|
||||||
/// use tokio::runtime::Runtime;
|
/// use tokio::runtime::Runtime;
|
||||||
/// use tokio::task;
|
/// use tokio::task;
|
||||||
///
|
///
|
||||||
|
Loading…
x
Reference in New Issue
Block a user