rust-lang / rust-lang/rust

Need comprehensive story for `target_feature` compat

Open
#140,570 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

A-target-feature C-bug E-needs-design T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

From https://github.com/rust-lang/rust/pull/138872 per Amanieu:

I do think we need a more general mechanism to indicate that 2 target features are mutually incompatible. For example:

  • RISC-V: Zfinx & F
  • RISC-V: I & E
  • ARM: mclass & rclass & aclass

Currently nothing stops you from enabling incompatible features with #[target_feature] and -C target-feature, which will crash LLVM.

We should be emitting an error way before anything gets to LLVM because we have to have a better idea of what features are actually compatible. We effectively need to have both global and local notions of it.

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

Read the linked PR #138872 and trace the existing #[target_feature] and -C target-feature handling before LLVM. Define how incompatible features such as RISC-V Zfinx/F and I/E should be rejected, including both global and local cases. Done means incompatible combinations produce compiler errors instead of reaching LLVM.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.