Repository: rust
Issue: (signal: 11, SIGSEGV: invalid memory reference) x86_64-unknown-linux-musl
Labels: T-compiler,O-musl,C-bug

<!--
I'm using rust nightly for development, I do my development in a windows machine but testing and package the software takes place in a docker container
-->

I do my development in windows but test and package the application in alpine, I have issues when creating any type of https client, it particularly fails when the code tries to create an https client of any sort, for example (s3 rusoto client, elasticsearch client)

I created a small project to actually re-produce this issue:
I'm using docker on alpine, here is my environment:

```

FROM alpine:3.13.4

# <channel>[-<date>][-<host>]
# <channel>       = stable|beta|nightly|<major.minor>|<major.minor.patch>
# <date>          = YYYY-MM-DD
# <host>          = <target-triple>
ARG TOOLCHAIN_CHANNEL=nightly
ARG TOOLCHAIN_DATE=2021-03-25
ARG TOOLCHAIN_HOST=x86_64-unknown-linux-musl

ENV RUSTUP_HOME=/usr/local/rustup \
    CARGO_HOME=/usr/local/cargo \
    PATH=/usr/local/cargo/bin:$PATH

RUN apk upgrade; \
    apk update; \ 
    apk add util-linux pciutils usbutils coreutils binutils findutils grep \
            curl bash openssl libressl-dev gcc build-base ca-certificates; \
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -v \
      --no-modify-path \
      --default-toolchain ${TOOLCHAIN_CHANNEL}-${TOOLCHAIN_DATE}-${TOOLCHAIN_HOST} \
      --profile minimal; \
    chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
    rustup --version; \
    cargo --version; \
    rustc --version; \
    rustup component add llvm-tools-preview; \
    rustup component add clippy; \
    cargo install grcov --vers 0.6.1;
```

as you can see, I locked it down to a specific nightly version ( but you can feel free to change it to any, I tried many versions.

main.rs:
```
static DEFAULT_ELASTIC_SEARCH_ADDRESS: &str =
    "https://myaddress.com";

use elasticsearch::http::transport::SingleNodeConnectionPool;
use elasticsearch::http::transport::TransportBuilder;
use elasticsearch::http::Url;
use elasticsearch::Error;
use elasticsearch::{auth::Credentials, Elasticsearch};

fn main() {
    let _client = create_client();
}


#[allow(dead_code)]
pub fn create_client() -> Result<Elasticsearch, Error> {
    let username = "user".to_string();
    let password = "password".to_string();
    let credentials = Credentials::Basic(username, password);
    let endpoint = DEFAULT_ELASTIC_SEARCH_ADDRESS.to_string();
    let url = Url::parse(&endpoint)?;
    let conn_pool = SingleNodeConnectionPool::new(url);
    let transport = TransportBuilder::new(conn_pool).auth(credentials).build()?;
    Ok(Elasticsearch::new(transport))
}


#[test]
fn query_studies_within_files() {
    let _client = create_client();
}
```


and the cargo.toml file
```
[package]
name = "test_http"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
dotenv = "0.15.0"
elasticsearch = "7.12.0-alpha.1"
rusoto_s3 = "0.46.0"
rusoto_core = "0.46.0"
rusoto_credential = "0.46.0"
serde = { version = "1.0.125", features = ["derive"] }
serde_yaml = "0.8.17"
serde_json = "1.0.64"
json = "0.12"
```


I'm not really sure what could possibly be the reason is, it something to do with `https` because if I remove the `https` from the url `static DEFAULT_ELASTIC_SEARCH_ADDRESS: &str =
    "https://myaddress.com";` to be `myaddress.com`, the test succeeds. however, of course, it would not get a proper client.

I just excepted this simple unit test that will create a client to succeed

Instead, this happened: I get (signal: 11, SIGSEGV: invalid memory reference) x86_64-unknown-linux-musl

### Meta
<!--
If you're using the stable version of the compiler, you should also check if the
bug also exists in the beta or nightly versions.
-->

`rustc --version --verbose`:
```
rustc --version --verbose
rustc 1.53.0-nightly (07e0e2ec2 2021-03-24)
binary: rustc
commit-hash: 07e0e2ec268c140e607e1ac7f49f145612d0f597
commit-date: 2021-03-24
host: x86_64-unknown-linux-musl
release: 1.53.0-nightly
LLVM version: 12.0.0
```

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary>Backtrace</summary>
<p>

```
<backtrace>
```

</p>
</details>