Skip to content

Conversation

Zalathar
Copy link
Contributor

@Zalathar Zalathar commented Sep 16, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

Enselic and others added 9 commits July 8, 2025 16:44
…default

The linux backtrace unwinder relies on unwind tables to work properly,
and generating and printing a backtrace is done by for example the
default panic hook.

Begin emitting unwind tables by default again with `-C panic=abort` (see
history below) so that backtraces work.

History
=======

Backtraces with `-C panic=abort` used to work in Rust 1.22 but broke in
Rust 1.23, because in 1.23 we stopped emitting unwind tables with `-C
panic=abort` (see 24cc38e).

In 1.45 (see cda9946) a workaround in the form
of `-C force-unwind-tables=yes` was added.

`-C panic=abort` was added in [Rust
1.10](https://blog.rust-lang.org/2016/07/07/Rust-1.10/#what-s-in-1-10-stable)
and the motivation was binary size and compile time. But given how
confusing that behavior has turned out to be, it is better to make
binary size optimization opt-in with `-C force-unwind-tables=no` rather
than default since the current default breaks backtraces.

Besides, if binary size is a primary concern, there are many other
tricks that can be used that has a higher impact.
All of the tier 3 targets in the list now link dynamically by default
(except mips64el-unknown-linux-muslabi64, I overlooked that one).

Adjust the list of targets expected to link statically accordingly.

Signed-off-by: Jens Reidel <[email protected]>
…trochenkov

Fix backtraces with `-C panic=abort` on linux; emit unwind tables by default

The linux backtrace unwinder relies on unwind tables to work properly, and generating and printing a backtrace is done by for example the default panic hook.

Begin emitting unwind tables by default again with `-C panic=abort` (see history below) so that backtraces work.

Closes rust-lang#81902 which is **regression-from-stable-to-stable**
Closes rust-lang#94815

### History

Backtraces with `-C panic=abort` used to work in Rust 1.22 but broke in Rust 1.23, because in 1.23 we stopped emitting unwind tables with `-C panic=abort` (see rust-lang#45031 and rust-lang#81902 (comment)).

In 1.45 a workaround in the form of `-C force-unwind-tables=yes` was added (see rust-lang#69984).

`-C panic=abort` was added in [Rust 1.10](https://blog.rust-lang.org/2016/07/07/Rust-1.10/#what-s-in-1-10-stable) and the motivation was binary size and compile time. But given how confusing that behavior has turned out to be, it is better to make binary size optimization opt-in with `-C force-unwind-tables=no` rather than default since the current default breaks backtraces.

Besides, if binary size is a primary concern, there are many other tricks that can be used that has a higher impact.

# Release Note Entry Draft:

## Compatibility Notes

* [Fix backtraces with `-C panic=abort` on Linux by generating unwind tables by default](rust-lang#143613). Build with `-C force-unwind-tables=no` to keep omitting unwind tables.
…rop, r=lcnr

remove FIXME block from `has_significant_drop`, it never encounters inference variables

The `FIXME` block in `Ty::has_significant_drop` is outdated as related queries can now handle type inference.

https://github.com/rust-lang/rust/blob/321a89bec57b8ca723d1af8f784490b950458c6a/compiler/rustc_middle/src/ty/util.rs#L1378-L1389

Closes rust-lang#86868 (other places mentioned in the issue have been resolved, or moved to other issues)

r? types
StateTransform: Do not renumber resume local.

MIR parameters are not explicitly assigned-to when entering the MIR body. If we want to save their values inside the coroutine state, we need to do so explicitly.

This was done by renaming the `_2` local, and introducing an explicit assignment pre-transform. This particular trick confuses me.

This version makes explicit that we are assigning parameters to saved locals.

r? `@dingxiangfei2009`
…t, r=jieyouxu

tests/run-make: Update list of statically linked musl targets

All of the tier 3 targets in the list now link dynamically by default (except `mips64el-unknown-linux-muslabi64`, I apparently overlooked that one in my PR that changed this).

Adjust the list of targets expected to link statically accordingly.

See also rust-lang#144410, which changed these targets.

Target by target:
- `mips64-unknown-linux-musl`: this target does not exist AFAICT
- `mips64-unknown-linux-muslabi64`: updated in the linked PR
- `powerpc-unknown-linux-musl`: updated in the linked PR
- `powerpc-unknown-linux-muslspe`: updated in the linked PR
- `powerpc64-unknown-linux-musl`: updated in the linked PR
- `riscv32gc-unknown-linux-musl`: updated in the linked PR
- `s390x-unknown-linux-musl`: updated in the linked PR
- `thumbv7neon-unknown-linux-musleabihf`: updated in the linked PR
@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Sep 16, 2025
@Zalathar
Copy link
Contributor Author

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Sep 16, 2025

📌 Commit e2b2c14 has been approved by Zalathar

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 16, 2025
@bors
Copy link
Collaborator

bors commented Sep 16, 2025

⌛ Testing commit e2b2c14 with merge 5abb1fe...

bors added a commit that referenced this pull request Sep 16, 2025
Rollup of 4 pull requests

Successful merges:

 - #143613 (Fix backtraces with `-C panic=abort` on linux; emit unwind tables by default)
 - #145181 (remove FIXME block from `has_significant_drop`, it never encounters inference variables)
 - #146552 (StateTransform: Do not renumber resume local.)
 - #146588 (tests/run-make: Update list of statically linked musl targets)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-19-3 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
---- [ui] tests/ui/rustc_public-ir-print/async-closure.rs stdout ----
Saved the actual stdout to `/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rustc_public-ir-print/async-closure/async-closure.stdout`
diff of stdout:

40     let  _3: i32;
41     let mut _4: &i32;
42     let mut _5: ();
-     let mut _6: &mut Context<'_>;
-     let mut _7: u32;
+     let mut _6: u32;
+     let mut _7: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
45     let mut _8: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
46     let mut _9: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
-     let mut _10: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
-     debug _task_context => _6;
+     debug _task_context => _2;
49     debug y => (*((*(_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6})).0: &i32));
50     debug y => _3;
51     bb0: {

-         _8 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
-         _7 = discriminant((*_8));
-         switchInt(move _7) -> [0: bb1, 1: bb2, otherwise: bb3];
+         _7 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
+         _6 = discriminant((*_7));
+         switchInt(move _6) -> [0: bb1, 1: bb2, otherwise: bb3];
55     }
56     bb1: {
-         _6 = move _2;
58         StorageLive(_3);
-         _9 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
-         _4 = CopyForDeref(((*_9).0: &i32));
+         _8 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
+         _4 = CopyForDeref(((*_8).0: &i32));
61         _3 = (*_4);
62         _5 = ();
63         StorageDead(_3);

64         _0 = std::task::Poll::Ready(move _5);
-         _10 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
-         discriminant((*_10)) = 1;
+         _9 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
+         discriminant((*_9)) = 1;
67         return;
68     }
69     bb2: {

78     let  _3: i32;
79     let mut _4: &i32;
80     let mut _5: ();
-     let mut _6: &mut Context<'_>;
-     let mut _7: u32;
+     let mut _6: u32;
+     let mut _7: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
83     let mut _8: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
84     let mut _9: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
-     let mut _10: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
-     debug _task_context => _6;
+     debug _task_context => _2;
87     debug y => (*((*(_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6})).0: &i32));
88     debug y => _3;
89     bb0: {

-         _8 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
-         _7 = discriminant((*_8));
-         switchInt(move _7) -> [0: bb1, 1: bb2, otherwise: bb3];
+         _7 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
+         _6 = discriminant((*_7));
+         switchInt(move _6) -> [0: bb1, 1: bb2, otherwise: bb3];
93     }
94     bb1: {
-         _6 = move _2;
96         StorageLive(_3);
-         _9 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
-         _4 = CopyForDeref(((*_9).0: &i32));
+         _8 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
+         _4 = CopyForDeref(((*_8).0: &i32));
99         _3 = (*_4);
100         _5 = ();
101         StorageDead(_3);

102         _0 = std::task::Poll::Ready(move _5);
-         _10 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
-         discriminant((*_10)) = 1;
+         _9 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
+         discriminant((*_9)) = 1;
105         return;
106     }
107     bb2: {

Note: some mismatched output was normalized before being compared
-     let mut _7: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6};
-     let mut _8: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6};
-     let mut _9: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6};
-         _7 = CopyForDeref((_1.0: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6}));
-         _8 = CopyForDeref((_1.0: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6}));
-         _9 = CopyForDeref((_1.0: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6}));
-     let mut _7: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6};
-     let mut _8: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6};
-     let mut _9: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6};
-         _7 = CopyForDeref((_1.0: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6}));
-         _8 = CopyForDeref((_1.0: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6}));
-         _9 = CopyForDeref((_1.0: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6}));
+     let mut _6: u32;
+     let mut _7: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
+     debug _task_context => _2;
+         _7 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
+         _6 = discriminant((*_7));
+         switchInt(move _6) -> [0: bb1, 1: bb2, otherwise: bb3];
+         _8 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
+         _4 = CopyForDeref(((*_8).0: &i32));
+         _9 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
+         discriminant((*_9)) = 1;
+     let mut _6: u32;
+     let mut _7: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6};
+     debug _task_context => _2;
+         _7 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
+         _6 = discriminant((*_7));
+         switchInt(move _6) -> [0: bb1, 1: bb2, otherwise: bb3];
+         _8 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
+         _4 = CopyForDeref(((*_8).0: &i32));
+         _9 = CopyForDeref((_1.0: &mut {async closure body@$DIR/async-closure.rs:9:22: 11:6}));
+         discriminant((*_9)) = 1;


The actual stdout differed from the expected stdout
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args rustc_public-ir-print/async-closure.rs`

error: 1 errors occurred comparing output.
status: exit status: 0
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/checkout/tests/ui/rustc_public-ir-print/async-closure.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1" "--target=x86_64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rustc_public-ir-print/async-closure" "-A" "unused" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2024" "-Z" "unpretty=stable-mir" "--crate-type" "lib" "-C" "panic=abort" "-Zmir-opt-level=0"
--- stdout -------------------------------
// WARNING: This is highly experimental output it's intended for rustc_public developers only.
// If you find a bug or want to improve the output open a issue at https://github.com/rust-lang/project-stable-mir.
fn foo() -> () {
    let mut _0: ();
    let  _1: i32;
    let  _2: {async closure@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:13: 9:21};
    let mut _3: &i32;
    debug y => _1;
    debug x => _2;
    bb0: {
        StorageLive(_1);
        _1 = 0_i32;
        StorageLive(_2);
        StorageLive(_3);
        _3 = &_1;
        _2 = {coroutine-closure@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:13: 9:21}(move _3);
        StorageDead(_3);
        _0 = ();
        StorageDead(_2);
        StorageDead(_1);
        return;
    }
}
fn foo::{closure#0}(_1: &{async closure@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:13: 9:21}) -> {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6} {
    let mut _0: {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6};
    let mut _2: &i32;
    let mut _3: &i32;
    debug y => (*((*_1).0: &i32));
    bb0: {
        StorageLive(_2);
        _3 = CopyForDeref(((*_1).0: &i32));
        _2 = &(*_3);
        _0 = {coroutine@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6}(move _2);
        StorageDead(_2);
        return;
    }
}
fn foo::{closure#0}::{closure#0}(_1: Pin<&mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6}>, _2: &mut Context<'_>) -> Poll<()> {
    let mut _0: Poll<()>;
    let  _3: i32;
    let mut _4: &i32;
    let mut _5: ();
    let mut _6: u32;
    let mut _7: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6};
    let mut _8: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6};
    let mut _9: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6};
    debug _task_context => _2;
    debug y => (*((*(_1.0: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6})).0: &i32));
    debug y => _3;
    bb0: {
        _7 = CopyForDeref((_1.0: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6}));
        _6 = discriminant((*_7));
        switchInt(move _6) -> [0: bb1, 1: bb2, otherwise: bb3];
    }
    bb1: {
        StorageLive(_3);
        _8 = CopyForDeref((_1.0: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6}));
        _4 = CopyForDeref(((*_8).0: &i32));
        _3 = (*_4);
        _5 = ();
        StorageDead(_3);
        _0 = std::task::Poll::Ready(move _5);
        _9 = CopyForDeref((_1.0: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6}));
        discriminant((*_9)) = 1;
        return;
    }
    bb2: {
        assert(false, `async fn` resumed after completion) -> [success: bb2, unwind unreachable];
    }
    bb3: {
        unreachable;
    }
}
fn foo::{closure#0}::{synthetic#0}(_1: Pin<&mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6}>, _2: &mut Context<'_>) -> Poll<()> {
    let mut _0: Poll<()>;
    let  _3: i32;
    let mut _4: &i32;
    let mut _5: ();
    let mut _6: u32;
    let mut _7: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6};
    let mut _8: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6};
    let mut _9: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6};
    debug _task_context => _2;
    debug y => (*((*(_1.0: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6})).0: &i32));
    debug y => _3;
    bb0: {
        _7 = CopyForDeref((_1.0: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6}));
        _6 = discriminant((*_7));
        switchInt(move _6) -> [0: bb1, 1: bb2, otherwise: bb3];
    }
    bb1: {
        StorageLive(_3);
        _8 = CopyForDeref((_1.0: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6}));
        _4 = CopyForDeref(((*_8).0: &i32));
        _3 = (*_4);
        _5 = ();
        StorageDead(_3);
        _0 = std::task::Poll::Ready(move _5);
        _9 = CopyForDeref((_1.0: &mut {async closure body@/checkout/tests/ui/rustc_public-ir-print/async-closure.rs:9:22: 11:6}));
        discriminant((*_9)) = 1;
        return;
    }
    bb2: {
        assert(false, `async fn` resumed after completion) -> [success: bb2, unwind unreachable];
    }
    bb3: {
        unreachable;
    }
}

@bors
Copy link
Collaborator

bors commented Sep 16, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 16, 2025
@Zalathar Zalathar closed this Sep 16, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 16, 2025
@Zalathar Zalathar deleted the rollup-hrqdohi branch September 16, 2025 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-run-make Area: port run-make Makefiles to rmake.rs rollup A PR which is a rollup T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants