kyren / gc-arena

Incremental garbage collection from safe Rust
Creative Commons Zero v1.0 Universal
438 stars 36 forks source link

Add #[track_caller] for better panic error messages #11

Closed adrian17 closed 3 years ago

adrian17 commented 3 years ago

Before:

Error message: panicked at 'already borrowed: BorrowMutError', gc-arena-0.2.0/src/gc_cell.rs:62:29

After: it shows the line that actually tried calling read()/write().

Error message: panicked at 'already borrowed: BorrowMutError', core/src/avm1/activation.rs:1186:48

Should help a bit with pinpointing error sources for library users :)

kyren commented 3 years ago

Yeah this makes sense to have.