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

Associate source file position with closures #10350

Closed
orenbenkiki opened this issue Nov 8, 2013 · 5 comments
Closed

Associate source file position with closures #10350

orenbenkiki opened this issue Nov 8, 2013 · 5 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.)

Comments

@orenbenkiki
Copy link

Allow the source file and line number to be shown in stack traces (e.g. in GDB). See https://mail.mozilla.org/pipermail/rust-dev/2013-November/006356.html

@jdm
Copy link
Contributor

jdm commented Nov 8, 2013

Are you building with -Z debug-info ? That should make source files and line numbers show up.

@emberian
Copy link
Member

emberian commented Nov 8, 2013

This shouldn't be that hard, I don't think. gdb would just need to know to dereference the fn pointer and look for debuginfo where it points to.

@emberian
Copy link
Member

emberian commented Nov 8, 2013

Given:

foo.rs:

pub fn bar(x: || -> int) -> int {
    x()
}

bar.rs:

extern mod foo;

fn main() {
    let mut y = 2;
    let x = || {
        42 * 7 + y
    };
    y = 5;
    foo::bar(x);
}

Compiling with rustc -Z extra-debug-info --lib foo.rs; rustc -L . -Z extra-debug-info bar.rs, and breaking on foo::bar, I do get file/line numbers in the stack trace for the closure.

@sanxiyn
Copy link
Member

sanxiyn commented Nov 8, 2013

Does someone have a non-working case?

@orenbenkiki
Copy link
Author

My bad, I followed up on the thread not realizing -Z debug-info solves the problem. Now, if there was a flag to get stack trace outside GDB... but that's another issue.

Thanks and apologies for needlessly opening the issue.

flip1995 pushed a commit to flip1995/rust that referenced this issue Mar 24, 2023
enhance [`ifs_same_cond`] to warn same immutable method calls as well

fixes: rust-lang#10272

---

changelog: Enhancement: [`ifs_same_cond`]: Now also detects immutable method calls.
[rust-lang#10350](rust-lang/rust-clippy#10350)
<!-- changelog_checked -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.)
Projects
None yet
Development

No branches or pull requests

4 participants