Rust not showing useful line number on panic. Showing line number in of stdlib

Hello, I have a problem I'm hoping I could get some help with.
When my program crashes instead of showing the relevant line number in my program, it instead displays the line number in of the Rust lib.

panicked at 'assertion failed: index < self.len()', src/libcore/
stack backtrace: fatal runtime error: Could not unwind stack, error = 5

The only way I can recreate the specific error message is by explicitly calling the index method on an array as shown here (rust playground) with the code below.

use std::ops::Index;
fn main() {
    let test_vec = [0,1,2,3,4,5,6];

    println!("{:?}", test_vec.index(10));
    // println!("{:?}", test_vec[10]);

When I index into the array with the bracket syntax, I get line number in my code to where it crashed.

However, I don't use that .index() method anywhere in my code, so I'm not sure why I get that error output with the line number. Is it possible one of my dependencies is using that method?

Has anyone else had this type of behavior? Thank you.

Normally Rust tells you to run with RUST_BACKTRACE=1. When you do, you'll get more useful information.

Here's a version that does this that doesn't require calling index manually.

fn main() {
    let test_vec = &[0,1,2,3,4,5,6];
    println!("{:?}", test_vec[10]);

The issue is that you're indexing into a slice beyond the end of the slice.

Thanks for the reply. I do actually run it with the backtrace crate here
but it still doesn't show a backtrace, not sure why. The original error output I posted above does have

stack backtrace: fatal runtime error: Could not unwind stack, error = 5

but I'm not sure if that's the backtrace failing or something else.

Also, that example you listed, when run on rust playground, Rust Playground, it shows the right line number (3) instead of showing the error occurring in line 530 of which is the issue I'm having. I know there's an out of bound indexing going on, I just can't figure out where and am not sure why I'm getting a not useful line number in the error output.

What platform are you working on? What happens if you don't use the backtrace crate? When you compile a program like

fn main() {

do you still get that stack backtrace error?

That platform that it's being run on is a 32 bit RHEL 5 machine (very old I know). It's a client machine, and I don't have much access to it. I can't recreate the crash since it crashes when running on their network data. I'm just trying to figure where the index out of bounds is without having to put a check in place before every single vector index. Sorry for the inconvenient situation.

I've also tried running it where RUST_BACKTRACE=1 is set as an environment variable in a script before running our program, and that works for me but not them, and I'm not sure how they're running it differently.

That does sound like a fatal problem when trying to unwind and print the stack trace.

If you're using RHEL 5, that means you're using kernel 2.6.18 or later, which is also Rust's minimum kernel version. I don't know what version of glbic Rust links against, bit it looks like there is an attempt to support back to RHEL 5 based on the kernel version.

I would probably file a ticket on the bug,