about summary refs log tree commit diff
path: root/compiler/rustc_mir/src/transform
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-07-10 18:39:25 +0200
committerMara Bos <m-ou.se@m-ou.se>2021-07-28 16:18:38 +0200
commit0b8033ad8d320c05ec24de5b4538099f6c3b2e4d (patch)
tree22633844c613061ded1b3c9f8a795ea0aa69c217 /compiler/rustc_mir/src/transform
parent4e6356188f14b2c05957a4671e7a8e857fa5f429 (diff)
downloadrust-0b8033ad8d320c05ec24de5b4538099f6c3b2e4d.tar.gz
rust-0b8033ad8d320c05ec24de5b4538099f6c3b2e4d.zip
Improve comments about const panic handling
Co-authored-by: Ralf Jung <post@ralfj.de>
Diffstat (limited to 'compiler/rustc_mir/src/transform')
-rw-r--r--compiler/rustc_mir/src/transform/check_consts/mod.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_mir/src/transform/check_consts/mod.rs b/compiler/rustc_mir/src/transform/check_consts/mod.rs
index ba8189cf9a8..7e22ed22db4 100644
--- a/compiler/rustc_mir/src/transform/check_consts/mod.rs
+++ b/compiler/rustc_mir/src/transform/check_consts/mod.rs
@@ -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()