axodotdev / axodotdev/cargo-dist

`dist` seems to ignore environmnet variables configured in `.cargo/config.toml`

Open
#1,571 6 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
2.1k
Forks
149
Avg merge
1d 11h
Merged PRs (30d)
32

Description

tl;dr: [minimally failing example](https://github.com/jan-ferdinand/dist-this)

### Description

In a project I'm working on, we're using [`tokio`'s unstable features](https://docs.rs/tokio/1.41.1/tokio/index.html#unstable-features). Those features require opt-in through an environmnent variable. This environment variable can be set in the file `.cargo/config.toml`, which is what we do. Unfortunately, `dist build` seems to ignore this configuration. As a result, the compilation step during `dist build` fails.

### What I've tried

- Running `RUSTFLAGS="--cfg tokio_unstable" dist build`[^1] works fine.
- I cannot [find](https://opensource.axo.dev/cargo-dist/book/?search=environment%20variable) anything applicable to this situation in the `dist` book.
- I was unable to identify similar issues here on github.

### Questions

1. Do you consider this a bug or missing feature, or am I miss- or even abusing `dist`?
2. Is there a maintainable workaround? I feel uncomfortable monkey-patching the `release.yml` to jam this environment variable in there every time I run `dist init`.
3. Do you need or want any additional information?

[^1]: as you might expect, `RUSTFLAGS="--cfg tokio_unstable"` is the environment variable configured in `.cargo/config.toml`

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the linked minimally failing example by running `dist build`, comparing it with `RUSTFLAGS="--cfg tokio_unstable" dist build`. Inspect how `dist build` handles `.cargo/config.toml` and the generated `release.yml`; done means the configured `RUSTFLAGS` is honored without manually patching `release.yml`.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, release
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.