Skip to content

tests: better-panic does not work with Rust 1.95 #597

Closed

Description

@martin-g

Rust 1.95 changed the backtraces format and this seems to break our usage of better-panic crate.

With [email protected]:

Nextest run ID f8fafd28-0f0b-4637-bcd1-0e449479a98f with nextest profile: default
    Starting 1 test across 22 binaries (670 tests skipped)
        FAIL [   0.276s] apache-avro serde::ser_schema::tests::avro_rs_529_enum_with_union_schema
  stdout ───

    running 1 test
    test serde::ser_schema::tests::avro_rs_529_enum_with_union_schema ... FAILED

    failures:

    failures:
        serde::ser_schema::tests::avro_rs_529_enum_with_union_schema

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 567 filtered out; finished in 0.27s

  stderr ───

    Run with RUST_BACKTRACE=full to include source snippets.
    Backtrace (most recent call first):
      File "/Users/mgrigorov/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/backtrace-0.3.76/src/backtrace/libunwind.rs", line 117, in backtrace[42e9788cec3e34c9]::backtrace::libunwind::trace
      File "/Users/mgrigorov/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/backtrace-0.3.76/src/backtrace/mod.rs", line 66, in backtrace[42e9788cec3e34c9]::backtrace::trace_unsynchronized::<better_panic[a1fca6dff4cef341]::print_backtrace::{closure#2}>
      File "/Users/mgrigorov/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/backtrace-0.3.76/src/backtrace/mod.rs", line 53, in backtrace[42e9788cec3e34c9]::backtrace::trace::<better_panic[a1fca6dff4cef341]::print_backtrace::{closure#2}>
      File "/Users/mgrigorov/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/better-panic-0.3.0/src/lib.rs", line 426, in better_panic[a1fca6dff4cef341]::print_backtrace
      File "/Users/mgrigorov/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/better-panic-0.3.0/src/lib.rs", line 570, in better_panic[a1fca6dff4cef341]::print_backtrace_info
      File "/Users/mgrigorov/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/better-panic-0.3.0/src/lib.rs", line 476, in better_panic[a1fca6dff4cef341]::print_panic_and_backtrace
      File "/Users/mgrigorov/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/better-panic-0.3.0/src/lib.rs", line 371, in <better_panic[a1fca6dff4cef341]::Settings>::create_panic_handler::{closure#0}
      File "rust:library/alloc/src/boxed.rs", line 2289, in <alloc[501706ae67335b2d]::boxed::Box<dyn for<'a, 'b> core[eea836d19939cdd9]::ops::function::Fn<(&'a std[b23ccf54642dae0e]::panic::PanicHookInfo<'b>,), Output = ()> + core[eea836d19939cdd9]::marker::Send + core[eea836d19939cdd9]::marker::Sync> as core[eea836d19939cdd9]::ops::function::Fn<(&std[b23ccf54642dae0e]::panic::PanicHookInfo,)>>::call
      File "rust:library/std/src/panicking.rs", line 833, in std[b23ccf54642dae0e]::panicking::panic_with_hook
      File "rust:library/std/src/panicking.rs", line 698, in std[b23ccf54642dae0e]::panicking::panic_handler::{closure#0}
      File "rust:library/std/src/sys/backtrace.rs", line 182, in std[b23ccf54642dae0e]::sys::backtrace::__rust_end_short_backtrace::<std[b23ccf54642dae0e]::panicking::panic_handler::{closure#0}, !>
      File "rust:library/std/src/panicking.rs", line 689, in __rustc[6c289b9f9c454d21]::rust_begin_unwind
      File "rust:library/core/src/panicking.rs", line 80, in core[eea836d19939cdd9]::panicking::panic_fmt
      File "/Users/mgrigorov/git/apache/avro-rs/avro_test_helper/src/lib.rs", line 67, in <apache_avro_test_helper[9e5f271360617606]::TestError as core[eea836d19939cdd9]::convert::From<apache_avro[763d475b2d5bf2f5]::error::Error>>::from
      File "/Users/mgrigorov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/result.rs", line 2189, in <core[eea836d19939cdd9]::result::Result<(), apache_avro_test_helper[9e5f271360617606]::TestError> as core[eea836d19939cdd9]::ops::try_trait::FromResidual<core[eea836d19939cdd9]::result::Result<core[eea836d19939cdd9]::convert::Infallible, apache_avro[763d475b2d5bf2f5]::error::Error>>>::from_residual
      File "/Users/mgrigorov/git/apache/avro-rs/avro/src/serde/ser_schema/mod.rs", line 2231, in apache_avro[763d475b2d5bf2f5]::serde::ser_schema::tests::avro_rs_529_enum_with_union_schema
      File "/Users/mgrigorov/git/apache/avro-rs/avro/src/serde/ser_schema/mod.rs", line 2223, in apache_avro[763d475b2d5bf2f5]::serde::ser_schema::tests::avro_rs_529_enum_with_union_schema::{closure#0}
      File "/Users/mgrigorov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs", line 250, in <apache_avro[763d475b2d5bf2f5]::serde::ser_schema::tests::avro_rs_529_enum_with_union_schema::{closure#0} as core[eea836d19939cdd9]::ops::function::FnOnce<()>>::call_once
      File "rust:library/core/src/ops/function.rs", line 250, in <fn() -> core[eea836d19939cdd9]::result::Result<(), alloc[501706ae67335b2d]::string::String> as core[eea836d19939cdd9]::ops::function::FnOnce<()>>::call_once
      File "rust:library/test/src/lib.rs", line 724, in test[ae24abad27a77d2a]::__rust_begin_short_backtrace::<core[eea836d19939cdd9]::result::Result<(), alloc[501706ae67335b2d]::string::String>, fn() -> core[eea836d19939cdd9]::result::Result<(), alloc[501706ae67335b2d]::string::String>>
      File "rust:library/test/src/lib.rs", line 747, in test[ae24abad27a77d2a]::run_test_in_process::{closure#0}
      File "rust:library/core/src/panic/unwind_safe.rs", line 275, in <core[eea836d19939cdd9]::panic::unwind_safe::AssertUnwindSafe<test[ae24abad27a77d2a]::run_test_in_process::{closure#0}> as core[eea836d19939cdd9]::ops::function::FnOnce<()>>::call_once
      File "rust:library/std/src/panicking.rs", line 581, in std[b23ccf54642dae0e]::panicking::catch_unwind::do_call::<core[eea836d19939cdd9]::panic::unwind_safe::AssertUnwindSafe<test[ae24abad27a77d2a]::run_test_in_process::{closure#0}>, core[eea836d19939cdd9]::result::Result<(), alloc[501706ae67335b2d]::string::String>>
      File "rust:library/std/src/panicking.rs", line 544, in std[b23ccf54642dae0e]::panicking::catch_unwind::<core[eea836d19939cdd9]::result::Result<(), alloc[501706ae67335b2d]::string::String>, core[eea836d19939cdd9]::panic::unwind_safe::AssertUnwindSafe<test[ae24abad27a77d2a]::run_test_in_process::{closure#0}>>
      File "rust:library/std/src/panic.rs", line 359, in std[b23ccf54642dae0e]::panic::catch_unwind::<core[eea836d19939cdd9]::panic::unwind_safe::AssertUnwindSafe<test[ae24abad27a77d2a]::run_test_in_process::{closure#0}>, core[eea836d19939cdd9]::result::Result<(), alloc[501706ae67335b2d]::string::String>>
      File "rust:library/test/src/lib.rs", line 747, in test[ae24abad27a77d2a]::run_test_in_process
      File "rust:library/test/src/lib.rs", line 668, in test[ae24abad27a77d2a]::run_test::{closure#0}
      File "rust:library/test/src/lib.rs", line 698, in test[ae24abad27a77d2a]::run_test::{closure#1}
      File "rust:library/std/src/sys/backtrace.rs", line 166, in std[b23ccf54642dae0e]::sys::backtrace::__rust_begin_short_backtrace::<test[ae24abad27a77d2a]::run_test::{closure#1}, ()>
      File "rust:library/std/src/thread/lifecycle.rs", line 70, in std[b23ccf54642dae0e]::thread::lifecycle::spawn_unchecked::<test[ae24abad27a77d2a]::run_test::{closure#1}, ()>::{closure#1}::{closure#0}
      File "rust:library/core/src/panic/unwind_safe.rs", line 275, in <core[eea836d19939cdd9]::panic::unwind_safe::AssertUnwindSafe<std[b23ccf54642dae0e]::thread::lifecycle::spawn_unchecked<test[ae24abad27a77d2a]::run_test::{closure#1}, ()>::{closure#1}::{closure#0}> as core[eea836d19939cdd9]::ops::function::FnOnce<()>>::call_once
      File "rust:library/std/src/panicking.rs", line 581, in std[b23ccf54642dae0e]::panicking::catch_unwind::do_call::<core[eea836d19939cdd9]::panic::unwind_safe::AssertUnwindSafe<std[b23ccf54642dae0e]::thread::lifecycle::spawn_unchecked<test[ae24abad27a77d2a]::run_test::{closure#1}, ()>::{closure#1}::{closure#0}>, ()>
      File "rust:library/std/src/panicking.rs", line 544, in std[b23ccf54642dae0e]::panicking::catch_unwind::<(), core[eea836d19939cdd9]::panic::unwind_safe::AssertUnwindSafe<std[b23ccf54642dae0e]::thread::lifecycle::spawn_unchecked<test[ae24abad27a77d2a]::run_test::{closure#1}, ()>::{closure#1}::{closure#0}>>
      File "rust:library/std/src/panic.rs", line 359, in std[b23ccf54642dae0e]::panic::catch_unwind::<core[eea836d19939cdd9]::panic::unwind_safe::AssertUnwindSafe<std[b23ccf54642dae0e]::thread::lifecycle::spawn_unchecked<test[ae24abad27a77d2a]::run_test::{closure#1}, ()>::{closure#1}::{closure#0}>, ()>
      File "rust:library/std/src/thread/lifecycle.rs", line 68, in std[b23ccf54642dae0e]::thread::lifecycle::spawn_unchecked::<test[ae24abad27a77d2a]::run_test::{closure#1}, ()>::{closure#1}
      File "rust:library/core/src/ops/function.rs", line 250, in <std[b23ccf54642dae0e]::thread::lifecycle::spawn_unchecked<test[ae24abad27a77d2a]::run_test::{closure#1}, ()>::{closure#1} as core[eea836d19939cdd9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
      File "rust:library/alloc/src/boxed.rs", line 2275, in <alloc[501706ae67335b2d]::boxed::Box<dyn core[eea836d19939cdd9]::ops::function::FnOnce<(), Output = ()> + core[eea836d19939cdd9]::marker::Send> as core[eea836d19939cdd9]::ops::function::FnOnce<()>>::call_once
      File "rust:library/std/src/sys/thread/unix.rs", line 118, in <std[b23ccf54642dae0e]::sys::thread::unix::Thread>::new::thread_start
      File "<unknown>", line 0, in __pthread_cond_wait

    The application panicked (crashed).
      apache_avro::error::Error: Error { details: Failed to parse schema from JSON: expected `,` or `]` at line 8 column 17 }
    in avro/src/serde/ser_schema/mod.rs, line 2231
    thread: serde::ser_schema::tests::avro_rs_529_enum_with_union_schema

  Cancelling due to test failure:
────────────
     Summary [   0.280s] 1 test run: 0 passed, 1 failed, 670 skipped
        FAIL [   0.276s] apache-avro serde::ser_schema::tests::avro_rs_529_enum_with_union_schema
error: test run failed

Without [email protected]:

Nextest run ID f590a527-5386-48ff-8b13-56a2237624c5 with nextest profile: default
    Starting 1 test across 22 binaries (670 tests skipped)
        FAIL [   0.130s] apache-avro serde::ser_schema::tests::avro_rs_529_enum_with_union_schema
  stdout ───

    running 1 test
    test serde::ser_schema::tests::avro_rs_529_enum_with_union_schema ... FAILED

    failures:

    failures:
        serde::ser_schema::tests::avro_rs_529_enum_with_union_schema

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 567 filtered out; finished in 0.12s

  stderr ───

    thread 'serde::ser_schema::tests::avro_rs_529_enum_with_union_schema' (2446643) panicked at avro/src/serde/ser_schema/mod.rs:2231:22:
    apache_avro::error::Error: Error { details: Failed to parse schema from JSON: expected `,` or `]` at line 8 column 17 }
    stack backtrace:
       0: __rustc::rust_begin_unwind
                 at /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/std/src/panicking.rs:689:5
       1: core::panicking::panic_fmt
                 at /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/core/src/panicking.rs:80:14
       2: <apache_avro_test_helper::TestError as core::convert::From<apache_avro::error::Error>>::from
                 at /Users/mgrigorov/git/apache/avro-rs/avro_test_helper/src/lib.rs:67:9
       3: <core::result::Result<(), apache_avro_test_helper::TestError> as core::ops::try_trait::FromResidual<core::result::Result<core::convert::Infallible, apache_avro::error::Error>>>::from_residual
                 at /Users/mgrigorov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/result.rs:2189:27
       4: apache_avro::serde::ser_schema::tests::avro_rs_529_enum_with_union_schema
                 at ./src/serde/ser_schema/mod.rs:2231:22
       5: apache_avro::serde::ser_schema::tests::avro_rs_529_enum_with_union_schema::{closure#0}
                 at ./src/serde/ser_schema/mod.rs:2223:48
       6: <apache_avro::serde::ser_schema::tests::avro_rs_529_enum_with_union_schema::{closure#0} as core::ops::function::FnOnce<()>>::call_once
                 at /Users/mgrigorov/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
       7: <fn() -> core::result::Result<(), alloc::string::String> as core::ops::function::FnOnce<()>>::call_once
                 at /rustc/2d8144b7880597b6e6d3dfd63a9a9efae3f533d3/library/core/src/ops/function.rs:250:5
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

  Cancelling due to test failure:
────────────
     Summary [   0.132s] 1 test run: 0 passed, 1 failed, 670 skipped
        FAIL [   0.130s] apache-avro serde::ser_schema::tests::avro_rs_529_enum_with_union_schema
error: test run failed
diff --git i/avro_test_helper/src/lib.rs w/avro_test_helper/src/lib.rs
index 851fa7b..7419a0b 100644
--- i/avro_test_helper/src/lib.rs
+++ w/avro_test_helper/src/lib.rs
@@ -35,11 +35,11 @@ thread_local! {
 #[ctor(unsafe)]
 fn before_all() {
     // better stacktraces in tests
-    better_panic::Settings::new()
-        .most_recent_first(true)
-        .lineno_suffix(false)
-        .backtrace_first(true)
-        .install();
+    // better_panic::Settings::new()
+    //     .most_recent_first(true)
+    //     .lineno_suffix(false)
+    //     .backtrace_first(true)
+    //     .install();

     // enable logging in tests
     logger::install();

Activity

  1. Kriskras99 commented on Jul 17, 2026

    @Kriskras99
    Contributor

    I think we're going to need to wait on a new backtrace version (which is what better-panic uses internally).

  2. martin-g commented on Jul 21, 2026

    @martin-g
    MemberAuthor

    I tried to find a better supported alternative to better-panic but I was not able to find any that does not have the same problem.

  3. Kriskras99 commented on Jul 21, 2026

    @Kriskras99
    Contributor

    Should we remove it then? It now results in worse panics than the normal panic. The normal panic is fine to use in my opinion.

  4. changed the title [-]tests: better-panic does not work with Rust 1.97[/-] [+]tests: better-panic does not work with Rust 1.95[/+] on Jul 21, 2026
  5. martin-g commented on Jul 21, 2026

    @martin-g
    MemberAuthor
  6. martin-g commented on Aug 23, 2026

    @martin-g
    MemberAuthor

    I will experiment a bit in the coming days.
    I will either inline/copy better-panic/src/lib.rs to avro-test-helper or remove it completely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions