bazelbuild / bazelbuild/rules_rust

`build-std` doesn't work

Open
#2,068 11 comments 3 reactions 0 assignees View on GitHub
needs-triage
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

We want to use the `-Zbuild-std` cargo flag to rebuild the standard library sanitized. This practice is requiredy by various sanitizers to work properly, for instance ThreadSanitizer and MemorySanitizer.

Since `build-std` is a Cargo flag it cannot be passed via `extra_rustc_flags`. So I tried adding a Cargo config file like

```toml
[unstable]
build-std = ["core", "std", "alloc", "proc_macro"]
```

to the `cargo_config` in `crates_repository`. That doesn't seem to have any effect at all though. Bug?

AFAICS to get behavior like with `build-std` we'd have to use a override the default BUILD file for the standard library, but that doesn't seem like a nice solution considering that this should work with a flag in the cargo config file.

Maybe I'm overlooking something though and this is already supported somehow?

Original issue: https://github.com/allada/turbo-cache/issues/188#issuecomment-1637103453

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.