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

Rollup of 7 pull requests #129012

Closed
wants to merge 26 commits into from

Commits on Aug 4, 2024

  1. std: refactor UNIX random data generation

    This PR makes a number of changes to the UNIX randomness implementation:
    * Use `io::Error` for centralized error handling
    * Move the file-fallback logic out of the `getrandom`-specific module
    * Stop redefining the syscalls on macOS and DragonFly, they have appeared in `libc`
    * Add a `OnceLock` to cache the random device file descriptor
    joboet committed Aug 4, 2024
    Configuration menu
    Copy the full SHA
    207ee73 View commit details
    Browse the repository at this point in the history

Commits on Aug 9, 2024

  1. Configuration menu
    Copy the full SHA
    acb0241 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a1b2b7f View commit details
    Browse the repository at this point in the history
  3. Rework MIR inlining debuginfo so function parameters show up in debug…

    …gers.
    
    Line numbers of multiply-inlined functions were fixed in rust-lang#114643 by using a
    single DISubprogram. That, however, triggered assertions because parameters
    weren't deduplicated. The "solution" to that in rust-lang#115417 was to insert a
    DILexicalScope below the DISubprogram and parent all of the parameters to that
    scope. That fixed the assertion, but debuggers (including gdb and lldb) don't
    recognize variables that are not parented to the subprogram itself as parameters,
    even if they are emitted with DW_TAG_formal_parameter.
    
    Consider the program:
    
    use std::env;
    
    fn square(n: i32) -> i32 {
        n * n
    }
    
    fn square_no_inline(n: i32) -> i32 {
        n * n
    }
    
    fn main() {
        let x = square(env::vars().count() as i32);
        let y = square_no_inline(env::vars().count() as i32);
        println!("{x} == {y}");
    }
    
    When making a release build with debug=2 and rustc 1.82.0-nightly (8b38707 2024-08-07)
    
    (gdb) r
    Starting program: /ephemeral/tmp/target/release/tmp
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
    
    Breakpoint 1, tmp::square () at src/main.rs:5
    5	    n * n
    (gdb) info args
    No arguments.
    (gdb) info locals
    n = 31
    (gdb) c
    Continuing.
    
    Breakpoint 2, tmp::square_no_inline (n=31) at src/main.rs:10
    10	    n * n
    (gdb) info args
    n = 31
    (gdb) info locals
    No locals.
    
    This issue is particularly annoying because it removes arguments from stack traces.
    
    The DWARF for the inlined function looks like this:
    
    < 2><0x00002132 GOFF=0x00002132>      DW_TAG_subprogram
                                            DW_AT_linkage_name          _ZN3tmp6square17hc507052ff3d2a488E
                                            DW_AT_name                  square
                                            DW_AT_decl_file             0x0000000f /ephemeral/tmp/src/main.rs
                                            DW_AT_decl_line             0x00000004
                                            DW_AT_type                  0x00001a56<.debug_info+0x00001a56>
                                            DW_AT_inline                DW_INL_inlined
    < 3><0x00002142 GOFF=0x00002142>        DW_TAG_lexical_block
    < 4><0x00002143 GOFF=0x00002143>          DW_TAG_formal_parameter
                                                DW_AT_name                  n
                                                DW_AT_decl_file             0x0000000f /ephemeral/tmp/src/main.rs
                                                DW_AT_decl_line             0x00000004
                                                DW_AT_type                  0x00001a56<.debug_info+0x00001a56>
    < 4><0x0000214e GOFF=0x0000214e>          DW_TAG_null
    < 3><0x0000214f GOFF=0x0000214f>        DW_TAG_null
    
    That DW_TAG_lexical_block inhibits every debugger I've tested from recognizing
    'n' as a parameter.
    
    This patch removes the additional lexical scope. Parameters can be easily
    deduplicated by a tuple of their scope and the argument index, at the trivial
    cost of taking a Hash + Eq bound on DIScope.
    khuey committed Aug 9, 2024
    Configuration menu
    Copy the full SHA
    0e4136b View commit details
    Browse the repository at this point in the history

Commits on Aug 10, 2024

  1. Configuration menu
    Copy the full SHA
    ed7bdbb View commit details
    Browse the repository at this point in the history
  2. Add test

    Co-authored-by: Georg Semmler <github@weiznich.de>
    compiler-errors and weiznich committed Aug 10, 2024
    Configuration menu
    Copy the full SHA
    20a16bb View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2024

  1. Configuration menu
    Copy the full SHA
    ce9de3b View commit details
    Browse the repository at this point in the history
  2. mark rust-lld-compress-debug-sections test as needing zstd

    also make it fail if there's a compression issue
    lqd committed Aug 11, 2024
    Configuration menu
    Copy the full SHA
    002878c View commit details
    Browse the repository at this point in the history
  3. make compressed-debuginfo test about zlib only

    zlib is seemingly always enabled, so we can test it unconditionally
    lqd committed Aug 11, 2024
    Configuration menu
    Copy the full SHA
    435405a View commit details
    Browse the repository at this point in the history
  4. prepare test for expanding scope

    lqd committed Aug 11, 2024
    Configuration menu
    Copy the full SHA
    57b7c0a View commit details
    Browse the repository at this point in the history
  5. expand zstd debuginfo compression test

    it now checks zlib and zstd, via rustc and rust-lld
    lqd committed Aug 11, 2024
    Configuration menu
    Copy the full SHA
    f656c5c View commit details
    Browse the repository at this point in the history
  6. move and rename zstd script

    move it where it's used, and name it like the other scripts
    lqd committed Aug 11, 2024
    Configuration menu
    Copy the full SHA
    4d6ac1e View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    d39d465 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    a566252 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    c5205e9 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    b5d2079 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    f15997f View commit details
    Browse the repository at this point in the history

Commits on Aug 12, 2024

  1. std: use /scheme/rand on Redox

    joboet committed Aug 12, 2024
    Configuration menu
    Copy the full SHA
    99c0d76 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6839a8f View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#128655 - joboet:play_with_the_dice, r=Chris…

    …Denton
    
    std: refactor UNIX random data generation
    
    This PR makes a number of changes to the UNIX randomness implementation:
    * Use `io::Error` for centralized error handling
    * Move the file-fallback logic out of the `getrandom`-specific module
    * Stop redefining the syscalls on macOS and DragonFly, they have appeared in `libc`
    * Add a `OnceLock` to cache the random device file descriptor
    matthiaskrgr committed Aug 12, 2024
    Configuration menu
    Copy the full SHA
    8d74688 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#128712 - compiler-errors:normalize-borrowck…

    …, r=lcnr
    
    Normalize struct tail properly for `dyn` ptr-to-ptr casting in new solver
    
    Realized that the new solver didn't handle ptr-to-ptr casting correctly.
    
    r? lcnr
    
    Built on rust-lang#128694
    matthiaskrgr committed Aug 12, 2024
    Configuration menu
    Copy the full SHA
    95716a7 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#128861 - khuey:mir-inlining-parameters-debu…

    …ginfo, r=wesleywiser
    
    Rework MIR inlining debuginfo so function parameters show up in debuggers.
    
    Line numbers of multiply-inlined functions were fixed in rust-lang#114643 by using a single DISubprogram. That, however, triggered assertions because parameters weren't deduplicated. The "solution" to that in rust-lang#115417 was to insert a DILexicalScope below the DISubprogram and parent all of the parameters to that scope. That fixed the assertion, but debuggers (including gdb and lldb) don't recognize variables that are not parented to the subprogram itself as parameters, even if they are emitted with DW_TAG_formal_parameter.
    
    Consider the program:
    
    ```rust
    use std::env;
    
    #[inline(always)]
    fn square(n: i32) -> i32 {
        n * n
    }
    
    #[inline(never)]
    fn square_no_inline(n: i32) -> i32 {
        n * n
    }
    
    fn main() {
        let x = square(env::vars().count() as i32);
        let y = square_no_inline(env::vars().count() as i32);
        println!("{x} == {y}");
    }
    ```
    
    When making a release build with debug=2 and rustc 1.82.0-nightly (8b38707 2024-08-07)
    
    ```
    (gdb) r
    Starting program: /ephemeral/tmp/target/release/tmp [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
    
    Breakpoint 1, tmp::square () at src/main.rs:5
    5	    n * n
    (gdb) info args
    No arguments.
    (gdb) info locals
    n = 31
    (gdb) c
    Continuing.
    
    Breakpoint 2, tmp::square_no_inline (n=31) at src/main.rs:10
    10	    n * n
    (gdb) info args
    n = 31
    (gdb) info locals
    No locals.
    ```
    
    This issue is particularly annoying because it removes arguments from stack traces.
    
    The DWARF for the inlined function looks like this:
    
    ```
    < 2><0x00002132 GOFF=0x00002132>      DW_TAG_subprogram
                                            DW_AT_linkage_name          _ZN3tmp6square17hc507052ff3d2a488E
                                            DW_AT_name                  square
                                            DW_AT_decl_file             0x0000000f /ephemeral/tmp/src/main.rs
                                            DW_AT_decl_line             0x00000004
                                            DW_AT_type                  0x00001a56<.debug_info+0x00001a56>
                                            DW_AT_inline                DW_INL_inlined
    < 3><0x00002142 GOFF=0x00002142>        DW_TAG_lexical_block
    < 4><0x00002143 GOFF=0x00002143>          DW_TAG_formal_parameter
                                                DW_AT_name                  n
                                                DW_AT_decl_file             0x0000000f /ephemeral/tmp/src/main.rs
                                                DW_AT_decl_line             0x00000004
                                                DW_AT_type                  0x00001a56<.debug_info+0x00001a56>
    < 4><0x0000214e GOFF=0x0000214e>          DW_TAG_null
    < 3><0x0000214f GOFF=0x0000214f>        DW_TAG_null
    ```
    
    That DW_TAG_lexical_block inhibits every debugger I've tested from recognizing 'n' as a parameter.
    
    This patch removes the additional lexical scope. Parameters can be easily deduplicated by a tuple of their scope and the argument index, at the trivial cost of taking a Hash + Eq bound on DIScope.
    matthiaskrgr committed Aug 12, 2024
    Configuration menu
    Copy the full SHA
    fa8f842 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#128873 - ChrisDenton:windows-targets, r=Mar…

    …k-Simulacrum
    
    Add windows-targets crate to std's sysroot
    
    With this PR, when backtrace is used as a crate from crates.io it will (once updated) use the real [windows-targets](https://crates.io/crates/windows-targets) crate. But when used from std it'll use std's replacement version.
    
    This allows sharing our customized `windows_tagets::link!` macro between std proper and the backtrace crate when used as part of std, ensuring a consistent linking story. This will be especially important once we move to using [`raw-dylib`](https://doc.rust-lang.org/reference/items/external-blocks.html#dylib-versus-raw-dylib) by default.
    matthiaskrgr committed Aug 12, 2024
    Configuration menu
    Copy the full SHA
    5e3a499 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#128912 - compiler-errors:do-not-recommend-i…

    …mpl, r=lcnr
    
    Store `do_not_recommend`-ness in impl header
    
    Alternative to rust-lang#128674
    
    It's less flexible, but also less invasive. Hopefully it's also performant. I'd recommend we think separately about the design for how to gate arbitrary diagnostic attributes moving forward.
    matthiaskrgr committed Aug 12, 2024
    Configuration menu
    Copy the full SHA
    22129b3 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#128935 - lqd:needs-zstd, r=Kobzol

    More work on `zstd` compression
    
    r? `@Kobzol` as we've discussed this.
    
    This is a draft to show the current approach of supporting zstd in compiletest, and making the tests using it unconditional.
    
    Knowing whether llvm/lld was built with `LLVM_ENABLE_ZSTD` is quite hard, so there are two strategies. There are details in the code, and we can discuss this approach. Until we know the config used to build CI artifacts, it seems our options are somewhat limited in any case.
    
    zlib compression seems always enabled, so we only check this in its dedicated test, allowing the test to ignore errors due to zstd not being supported.
    
    The zstd test is made unconditional in what it tests, by relying on `needs-llvm-zstd` to be ignored when `llvm.libzstd` isn't enabled in `config.toml`.
    
    try-job: x86_64-gnu
    matthiaskrgr committed Aug 12, 2024
    Configuration menu
    Copy the full SHA
    4c2362a View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#129000 - RalfJung:miri-bootstrap-clear, r=o…

    …nur-ozkan
    
    bootstrap: clear miri ui-test deps when miri sysroot gets rebuilt
    
    Second attempt after rust-lang#128683: seems like it's not the compiler changing that we care about, but the sysroot changing.
    
    I did some local testing with sysroot rebuilds and it works fine for at least those cases I checked.
    
    r? `@onur-ozkan`
    matthiaskrgr committed Aug 12, 2024
    Configuration menu
    Copy the full SHA
    23cf189 View commit details
    Browse the repository at this point in the history