Towards Fixing Panic Bugs for Real-world Rust Programs
<|reference_start|>Towards Fixing Panic Bugs for Real-world Rust Programs: The Rust programming language has garnered significant attention due to its robust safety features and memory management capabilities. Despite its guaranteed memory safety, Rust programs still suffer from runtime errors that are unmanageable, i.e., panic errors. Notably, over half of the bugs in rustc, Rust's own compiler, are attributable to crash stemming from panic errors. However, understanding root causes and resolving these panics often requires substantial effort due to the limited information provided, and the stack backtrace could be intricate, often omitting the actual fault locations. Although numerous automated program repair techniques exist, we observe that the prevailing fix patterns do not readily apply to Rust programs due to natural differences in language mechanisms. To tackle the above challenges, this paper introduces a systematic study aimed at fixing Rust panic bugs. We commence by assembling a dataset, namely Panic4R, which includes 102 real panic bugs and their fixes from the top 500 most downloaded open-source crates. By analyzing Rust's implementation, we identify Rust-specific patterns for fixing panic bugs, which can aid in understanding and providing guidance for generating patches. Finally, we design and implement the first automated fixing tool, PanicKiller, for Rust panic bugs, which effectively generates correct patches on the real-world large-scale dataset, and has already assisted in the resolution of 28 panic bugs in open-source projects. Each resolved issue has been validated by the developers and merged into the respective codebases.<|reference_end|>
@article{ni2024panicfi:,
    title={PanicFI: An Infrastructure for Fixing Panic Bugs in Real-World Rust
  Programs},
    author={Yunbo Ni, Yang Feng, Zixi Liu, Runtao Chen, Baowen Xu},
    journal={arXiv preprint arXiv:2408.03262},
    year={2024},
    archivePrefix={arXiv},
    eprint={2408.03262},
    primaryClass={cs.SE}
}