Skip to content

Stuck on the call to def_path_str #141546

Open
@xizheyin

Description

@xizheyin

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

let source_map = self.r.tcx.sess.source_map();
// check if the field is used in a format string, such as `"{x}"`

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-query-systemArea: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html)C-discussionCategory: Discussion or questions that doesn't represent real issues.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions