You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the original RefCell implementation there is a cfg feature called "debug_refcell", which in case of a panic allows to see where a RefCell was first borrowed:
pubstructRefCell<T: ?Sized>{borrow:Cell<BorrowFlag>,// Stores the location of the earliest currently active borrow.// This gets updated whenever we go from having zero borrows// to having a single borrow. When a borrow occurs, this gets included// in the generated `BorrowError/`BorrowMutError`#[cfg(feature = "debug_refcell")]borrowed_at:Cell<Option<&'static crate::panic::Location<'static>>>,value:UnsafeCell<T>,}
I read that you stripped RefCell of everything that conflicted multi-thread environment. Is it because of this that the debug feature was removed? Is it hard to reimplement it back? Pushing borrow checking into runtime leaves us with less info to investigate things. This leads projects like accountable-refcell to store the whole stack trace per RefCell. Well, that much of an overhead is probably overkill, but to have the minimal "borrowed_at" info is an essential thing to have for debug builds, don't you think?🤔
The text was updated successfully, but these errors were encountered:
That does seem like a useful feature. That said, adding conditionally-compiled debug code to the core borrowing logic would make it somewhat more complex, and I've been trying hard to keep it a simple as possible.
If someone wants to implement this feature, I'd be happy to take it on a branch in this repo (without any conditional compilation). That way, anyone debugging such a failure could simply put a [patch] in their Cargo.toml to point to that branch, which is not substantially more difficult then modifying Cargo.toml to enable a debug_refcell feature.
In the original RefCell implementation there is a cfg feature called "debug_refcell", which in case of a panic allows to see where a RefCell was first borrowed:
I read that you stripped RefCell of everything that conflicted multi-thread environment. Is it because of this that the debug feature was removed? Is it hard to reimplement it back? Pushing borrow checking into runtime leaves us with less info to investigate things. This leads projects like accountable-refcell to store the whole stack trace per RefCell. Well, that much of an overhead is probably overkill, but to have the minimal "borrowed_at" info is an essential thing to have for debug builds, don't you think?🤔
The text was updated successfully, but these errors were encountered: