rust-lang / rust-lang/rust

use osc 8 hyperlinks to link to the reference for lints when they are printed

Open
#125,528 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

-Zterminal-urls A-diagnostics T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
struct Foo;
Current output
⣿
Standard Error

   Compiling playground v0.0.1 (/playground)
warning: struct `Foo` is never constructed
 --> src/lib.rs:1:8
  |
1 | struct Foo;
  |        ^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: `playground` (lib) generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.33s
Desired output
same as above, but with the `#[warn(dead_code)]` part being an [osc 8](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) hyperlink to <https://doc.rust-lang.org/rustc/lints/listing/warn-by-default.html#dead-code>.
Rationale and extra context

cargo already does something similar, see https://github.com/rust-lang/cargo/blob/a8d72c675ee52dd57f0d8f2bae6655913c15b2fb/src/cargo/core/compiler/job_queue/mod.rs#L830

something similar could also be done for numbered error messages.

Other cases

No response

Rust Version
rustc 1.80.0-nightly (9cdfe285c 2024-05-22)
binary: rustc
commit-hash: 9cdfe285ca724c801dc9f78d22b24ea69b787f26
commit-date: 2024-05-22
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.6
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 by reviewing the lint output shown in the issue and Cargo's related implementation at src/cargo/core/compiler/job_queue/mod.rs around line 830. Trace where rustc renders the lint reference and determine how OSC 8 links should wrap the lint name; done means the dead-code reference is hyperlinked to its Rust documentation URL without changing other diagnostic output.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.