rust-lang / rust-lang/rust

target-feature=-c doesn't disable zca feature on RISC-V

Open
#147,667 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug O-riscv P-low T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code

I tried this code:

$(rustup which rustc --toolchain nightly) --target riscv32imac-unknown-none-elf -C target-feature=-c --print=cfg | grep target_feature

I expected to see this happen:
no target_feature="zca" in the output, because zca is the implied feature of "c".

Instead, this happened:
the output has target_feature="zca":

$(rustup which rustc --toolchain nightly) --target riscv32imac-unknown-none-elf -C target-feature=-c --print=cfg | grep target_feature
target_feature="a"
target_feature="m"
target_feature="zaamo"
target_feature="zalrsc"
target_feature="zca"
Version it worked on

It most recently worked on: Rust 1.90

Version with regression
$(rustup which rustc --toolchain 1.90) --target riscv32imac-unknown-none-elf -C target-feature=-c --print=cfg | grep target_feature
target_feature="a"
target_feature="m"

rustc --version --verbose:

rustc 1.90.0 (1159e78c4 2025-09-14)
binary: rustc
commit-hash: 1159e78c4747b02ef996e55082b704c09b970588
commit-date: 2025-09-14
host: aarch64-unknown-linux-gnu
release: 1.90.0
LLVM version: 20.1.8
Backtrace
Backtrace

<backtrace>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided rustc commands for riscv32imac-unknown-none-elf on the affected and working versions, then trace rustc's RISC-V target-feature handling. Check how disabling c affects the implied zca feature. Done means the affected command no longer reports target_feature="zca" while the other expected features remain unchanged, with regression coverage added.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.