Improve comments about const panic handling

Co-authored-by: Ralf Jung <post@ralfj.de>
This commit is contained in:
Mara Bos
2021-07-10 18:39:25 +02:00
parent 4e6356188f
commit 0b8033ad8d
3 changed files with 7 additions and 2 deletions

View File

@@ -74,6 +74,9 @@ impl ConstCx<'mir, 'tcx> {
/// Returns `true` if this `DefId` points to one of the official `panic` lang items.
pub fn is_lang_panic_fn(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
// We can allow calls to these functions because `hook_panic_fn` in
// `const_eval/machine.rs` ensures the calls are handled specially.
// Keep in sync with what that function handles!
Some(def_id) == tcx.lang_items().panic_fn()
|| Some(def_id) == tcx.lang_items().panic_str()
|| Some(def_id) == tcx.lang_items().begin_panic_fn()