Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#[rustc_pass_by_value] prevents lldb from showing the information correctly #125121

Closed
dev-ardi opened this issue May 14, 2024 · 6 comments
Closed
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues.

Comments

@dev-ardi
Copy link
Contributor

dev-ardi commented May 14, 2024

image

#![feature(rustc_attrs)]

#[rustc_pass_by_value]
#[derive(Debug, Clone)]
struct Val;

#[derive(Debug, Clone)]
enum E {
    Foo,
    Bar(Val),
}

fn main() {
    let x = E::Foo;
    let y = E::Bar(Val);
    dbg!(x, y);
}

As you can see x and y have the representation of {...}.

This makes it very hard to use a debugger in rustc.

@dev-ardi dev-ardi added the C-bug Category: This is a bug. label May 14, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 14, 2024
@compiler-errors
Copy link
Member

This seems like a rust-analyzer bug with macros.

@dev-ardi
Copy link
Contributor Author

What does rust-analyzer have to do here? I thought that the debug representation was all lldb. In fact r-a server is stopped in that screenshot :P

@compiler-errors
Copy link
Member

compiler-errors commented May 15, 2024

Well then it's some other aspect of IDE integration, and it doesn't have anything to do with rustc. All that rustc_pass_by_value does is mark it for lint purposes: 4c3e330.

Also, what do you mean the r-a server is stopped in that screenshot? Isn't the "2 implementations" hint over struct Val a rust-analyzer feature?

@compiler-errors
Copy link
Member

Also, if you're trying to use rustc_pass_by_value in your own project? That is definitely not supported.

@compiler-errors
Copy link
Member

Also, I'm pretty certain this has nothing to do with rustc_pass_by_value.

I deleted the annotations on your test example, attached CodeLLDB for the debugger in vscode, and I'm still getting the same output you shared:

image

From a cursory search on the internet, I don't believe Rust has very good lldb support for debug-printing its data. I'm gonna close this issue.

@saethlin saethlin added C-discussion Category: Discussion or questions that doesn't represent real issues. and removed C-bug Category: This is a bug. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels May 15, 2024
@dev-ardi
Copy link
Contributor Author

This is embarrasing :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-discussion Category: Discussion or questions that doesn't represent real issues.
Projects
None yet
Development

No branches or pull requests

4 participants