Description
When calling an unwrap on a value that should be Some, i instead get an unwrap on None error. Attaching a debugger seems to show an invalid memory error.
This issue happens only when opt-level is set to at least 1, (aka in dev profile, no panic happens, and in release it does), and only happens in rust nightly 1.83.0 and 1.84.0, it does not happen on stable and nightly 1.82.0.
I'm not sure if the issue is in my code or in the sprs crate, i've filed an issue there and also here just to make sure.
EDIT: managed to narrow down the bug by removing the sprs crate, this is only pure rust
Here is the repo for minimum example or in the playground, there is an even smaller reproduction in the comments
To reproduce, run cargo run --release
which will panic, while if running cargo run
it won't panic
I've tried to run this with miri, nothing there. Also tried to run the release mode with bounds checking turned on, but nothing changed
Meta
rustc --version --verbose
:
rustc 1.84.0-nightly (3f1be1ec7 2024-10-28)
binary: rustc
commit-hash: 3f1be1ec7ec3d8e80beb381ee82164a0aa3ca777
commit-date: 2024-10-28
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.1
Backtrace
thread 'main' panicked at src/main.rs:122:27:
called `Option::unwrap()` on a `None` value
stack backtrace:
0: rust_begin_unwind
at /rustc/3f1be1ec7ec3d8e80beb381ee82164a0aa3ca777/library/std/src/panicking.rs:665:5
1: core::panicking::panic_fmt
at /rustc/3f1be1ec7ec3d8e80beb381ee82164a0aa3ca777/library/core/src/panicking.rs:75:14
2: core::panicking::panic
at /rustc/3f1be1ec7ec3d8e80beb381ee82164a0aa3ca777/library/core/src/panicking.rs:152:5
3: core::option::unwrap_failed
at /rustc/3f1be1ec7ec3d8e80beb381ee82164a0aa3ca777/library/core/src/option.rs:2008:5
4: microlp::order_simple
5: microlp::main
at ./src/main.rs:152:5
6: core::ops::function::FnOnce::call_once
at /home/specy/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5