rust-lang / rust-lang/rust

Reasons for feature removals are not translatable

Open
#123,920 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics A-translation P-low T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
#![feature(box_syntax)]

fn main() {}
Current output
error[E0557]: feature has been removed
 --> foo.rs:1:12
  |
1 | #![feature(box_syntax)]
  |            ^^^^^^^^^^ feature has been removed
  |
  = note: replaced with `#[rustc_box]`

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0557`.
Desired output

The note ("replaced with #[rustc_box]") should be translatable, rather than hard-coded in compiler/rustc_feature/src/removed.rs.

Rationale and extra context

The reason field in RemovedFeature cannot simply be replaced with a DiagMessage because rustc_features cannot depend on rustc_errors (cyclic dependency). I don't know how to solve this.

Other cases

No response

Rust Version
rustc 1.79.0-nightly (79424056b 2024-04-12)
binary: rustc
commit-hash: 79424056b05eaa9563d16dfab9b9a0c8f033f220
commit-date: 2024-04-12
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.3
Anything else?

No response

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 in compiler/rustc_feature/src/removed.rs and inspect the RemovedFeature reason field, then trace how rustc_features and rustc_errors are connected. Determine an approach that preserves the dependency constraints while making the removal note translatable. Done means the hard-coded replacement note is emitted through the compiler's translation system.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.