RefCell fails without any msg

I'm finding this behavior really poor. Surely if we borrow_mut on ref_cell more than one, then the panic should display some info?
As things are now, program simply terminates, and try to be smart and guess why...

What info could it display (aside of what is shown with RUST_BACKTRACE=1)?

Similar info to (run without RUST_BACKTRACE=1):

let a = vec![0, 1];
    println!("{}", a[2]);

error: thread 'main' panicked at 'index out of bounds:

I'm seeing:

thread 'main' panicked at 'already mutably borrowed: BorrowError', src/

Thanks, on the isolated example I also see it at my machine. In my project though I still get no output, just app stops at:
let rc_current_path = Rc : : new(RefCell::new(String::from("/")));

later on, down the code:

*rc_current_path.borrow_mut() = String::from("Some/path");//this is second borrow, the first in immutable

Does your app have panic = "abort" set? I.e., does it stop in the same way without any message if you explicitly use panic! somewhere?

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.