diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a029da139..8a2a810c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,7 @@ jobs: needs: - style - test + - unstable - nightly - msrv - android @@ -182,6 +183,22 @@ jobs: - name: Test run: cargo test ${{ matrix.features }} ${{ matrix.test-features }} -- --test-threads=1 + unstable: + name: "unstable features" + needs: [style] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: 'stable' + + - name: Check + run: RUSTFLAGS="--cfg reqwest_unstable" cargo check --features http3 + docs: name: Docs runs-on: ubuntu-latest @@ -195,7 +212,7 @@ jobs: - name: Check documentation env: - RUSTDOCFLAGS: -D warnings + RUSTDOCFLAGS: --cfg reqwest_unstable -D warnings run: cargo doc --no-deps --document-private-items --all-features # Separate build job for nightly because of the missing feature for allowed failures at @@ -222,6 +239,8 @@ jobs: # run: cargo test --features __internal_proxy_sys_no_cache -- --test-threads=1 - name: Check minimal versions + env: + RUSTFLAGS: --cfg reqwest_unstable run: | cargo clean cargo update -Z minimal-versions diff --git a/src/lib.rs b/src/lib.rs index dddcdf114..ab11b3c89 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -191,6 +191,22 @@ //! - **trust-dns**: Enables a trust-dns async resolver instead of default //! threadpool using `getaddrinfo`. //! +//! ## Unstable Features +//! +//! Some feature flags require additional opt-in by the application, by setting +//! a `reqwest_unstable` flag. +//! +//! - **http3** *(unstable)*: Enables support for sending HTTP/3 requests. +//! +//! These features are unstable, and experimental. Details about them may be +//! changed in patch releases. +//! +//! You can pass such a flag to the compiler via `.cargo/config`, or +//! environment variables, such as: +//! +//! ```notrust +//! RUSTFLAGS="--cfg reqwest_unstable" cargo build +//! ``` //! //! [hyper]: http://hyper.rs //! [blocking]: ./blocking/index.html @@ -203,6 +219,14 @@ //! [Proxy]: ./struct.Proxy.html //! [cargo-features]: https://doc.rust-lang.org/stable/cargo/reference/manifest.html#the-features-section +#[cfg(all(feature = "http3", not(reqwest_unstable)))] +compile_error!( + "\ + The `http3` feature is unstable, and requires the \ + `RUSTFLAGS='--cfg reqwest_unstable'` environment variable to be set.\ +" +); + macro_rules! if_wasm { ($($item:item)*) => {$( #[cfg(target_arch = "wasm32")]