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

debug-info/limited-debuginfo.rs failure #12877

Closed
emberian opened this issue Mar 14, 2014 · 3 comments
Closed

debug-info/limited-debuginfo.rs failure #12877

emberian opened this issue Mar 14, 2014 · 3 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-testsuite Area: The testsuite used to check the correctness of rustc

Comments

@emberian
Copy link
Member

        error: line not found in debugger output: static void [...]main();
        command: gdb -quiet -batch -nx -command=x86_64-unknown-linux-gnu/test/debug-info/limited-debuginfo.debugger.script x86_64-unknown-linux-gnu/test/debug-info/limited-debuginfo.stage2-x86_64-unknown-linux-gnu
        stdout:
        ------------------------------------------
        All defined functions:

        File /home/cmr/hacking/rust/src/test/debug-info/limited-debuginfo.rs:
        static void limited-debuginfo::main(void);
        static void limited-debuginfo::some_function(void);
        static void limited-debuginfo::some_other_function(void);
        static void limited-debuginfo::zzz(void);

I think this might be because my terminal is too wide, or perhaps gdb version differences?

cc @michaelwoerister

@jdm
Copy link
Contributor

jdm commented Mar 14, 2014

It appears we should be searching for static void [...]main([...]); to account for the void.

@michaelwoerister
Copy link
Member

This seems to be a duplicate of #12787.

@emberian
Copy link
Member Author

Indeed it does, and I have gdb 7.7 here.

matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this issue Aug 2, 2022
fix: Insert spaces when inlining a function defined in a macro.

(partially) fixes rust-lang#12860.

This PR (only) addresses the whitespace issue when inlining functions defined in macros.

Additionally, the indentation/spacing is not ideal, but works, e.g.
```rs
macro_rules! define_function {
    () => { fn test_function_macro() {
        if let Some(3) = 3i32.checked_add(0) {
            println!("3 + 0 == 3");
        }
    } };
}
define_function!();
fn main() {
    test_function_macro();
}
// previously became
// ...
fn main() {
    ifletSome(3)=3i32.checked_add(0){println!("3 + 0 == 3");};
}
// now becomes
// ...
fn main() {
    if let Some(3) = 3i32.checked_add(0){
        println!("3 + 0 == 3");

      };
}
```

The `self` -> `this` problem[^this] is (probably?) a separate problem that I am also looking into.

[^this]: As mentioned in [my comment on the above issue](rust-lang/rust-analyzer#12860 (comment)), inlining a method defined in a macro does not properly replace `self` with the new local `this`.
flip1995 pushed a commit to flip1995/rust that referenced this issue Jun 13, 2024
Handle const effects inherited from parent correctly in `type_certainty`

This fixes a (debug) ICE in `type_certainty` that happened in the [k256 crate]. (I'm sure you can also specifically construct an edge test case that will run into type_certainty false positives visible outside of debug builds from this bug)

<details>
<summary>Minimal ICE repro</summary>

```rs
use std::ops::Add;
Add::add(1_i32, 1).add(i32::MIN);
```
</details>

The subtraction here overflowed:
https://github.com/rust-lang/rust-clippy/blob/436675b4772049a0ff535bd46d944689c90ed750/clippy_utils/src/ty/type_certainty/mod.rs#L209

... when we have something like `Add::add` where `add` fn has 0 generic params but the `host_effect_index` is `Some(2)` (inherited from the parent generics, the const trait `Add`), and we end up executing `0 - 1`.

(Even if the own generics weren't empty and we didn't overflow, this would still be wrong because it would assume that a trait method with 1 generic parameter didn't have any generics).

So, *only* exclude the "host" generic parameter if it's actually bound by the own generics

changelog: none

[k256 crate]: https://github.com/RustCrypto/elliptic-curves/tree/master/k256
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.) A-testsuite Area: The testsuite used to check the correctness of rustc
Projects
None yet
Development

No branches or pull requests

4 participants