Can't build statically-linked binary with rustls dependency

If I declare rustls dependency in Cargo.toml:

rustls = "0.21"

In my

use rustls::*;

fn main() {}

Then I compile this with

RUSTFLAGS='-C target-feature=+crt-static' cargo build --release

The generated binary is still dynamically-linked.

Note that if I remove the use rustls::*; line in, the generated binary is statically-linked as expected.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.