Improve comments about const panic handling
Co-authored-by: Ralf Jung <post@ralfj.de>
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user