rust-lang / rust-lang/rust

Devise mechanism for ensuring `tcx.short_string` is actually used

Open
#144,374 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics D-diagnostic-infra P-low 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/144039#discussion_r2219627544

This probably illustrates a problem we have with the current system: we don't prevent if a short string was created but was never printed. I think there could be a mechanism (a drop guard for a custom short_string return newtype) in which we detect that. Could you open an issue?

One alternative is to completely migrate any diagnostic mentioning types to structured errors, as those already handle path shortening appropriately.

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 with the linked discussion in rust-lang/rust#144039 and inspect how short strings and structured errors currently handle diagnostic type paths. Done means establishing a mechanism that detects an unused short string or completing the proposed migration to structured errors.

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
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.