rust-lang / rust-lang/rust

Stuck on the call to `def_path_str`

Open
#141,546 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-query-system C-discussion T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

In rustc, I added one line of code between L754 and L755

https://github.com/rust-lang/rust/blob/84f67a5e51bf1695a0c368a9f44a15f15cdf6b9e/compiler/rustc_resolve/src/late/diagnostics.rs#L754-L755

I added this code

                            tracing::info!("macro_def_id: {:?}", self.r.tcx.def_path_str(span.ctxt().outer_expn_data().macro_def_id.unwrap()));

And I build it using:

./x build --stage 1

And run it on this code by rustc +stage1 xxx

struct Foo {
    x: i32
}

impl Foo {
    fn foo(&self) {
        let _ = format!("{x}"); //~ ERROR cannot find value `x` in this scope [E0425]
    }
}

fn main(){}

I expected to see this happen:

it print something

Instead, this happened:

It stucked

Image

Meta

rustc --version --verbose:

rustc 1.89.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.89.0-dev
LLVM version: 20.1.5
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

Reproduce the hang in compiler/rustc_resolve/src/late/diagnostics.rs around lines 754-755 using the reported ./x build --stage 1 command and the provided format! example. Start at the added tracing call to def_path_str and determine why execution does not return; done means identifying the cause and providing a fix or clear diagnosis.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.