about summary refs log tree commit diff
path: root/compiler/rustc_middle
diff options
context:
space:
mode:
authorMaybe Waffle <waffle.lapkin@gmail.com>2023-05-11 11:43:09 +0000
committerMaybe Lapkin <waffle.lapkin@gmail.com>2024-11-29 04:44:41 +0100
commitcfb78419cd865a19dac54d234d2a6abde0f14628 (patch)
treed16774324337b1b56560124fe33bdd3513546df3 /compiler/rustc_middle
parentc1cfab230ebb2e9cb9f4ea69773fef956c706a71 (diff)
downloadrust-cfb78419cd865a19dac54d234d2a6abde0f14628.tar.gz
rust-cfb78419cd865a19dac54d234d2a6abde0f14628.zip
implement checks for tail calls
this implements checks necessary to guarantee that we can actually
perform a tail call. while extremely restrictive, this is what is
documented in the RFC, and all these checks are needed for one reason or
another.
Diffstat (limited to 'compiler/rustc_middle')
-rw-r--r--compiler/rustc_middle/src/query/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs
index 0f2a6d598a0..d3748af4077 100644
--- a/compiler/rustc_middle/src/query/mod.rs
+++ b/compiler/rustc_middle/src/query/mod.rs
@@ -916,6 +916,12 @@ rustc_queries! {
         cache_on_disk_if { true }
     }
 
+    /// Checks well-formedness of tail calls (`become f()`).
+    query check_tail_calls(key: LocalDefId) -> Result<(), rustc_errors::ErrorGuaranteed> {
+        desc { |tcx| "tail-call-checking `{}`", tcx.def_path_str(key) }
+        cache_on_disk_if { true }
+    }
+
     /// Returns the types assumed to be well formed while "inside" of the given item.
     ///
     /// Note that we've liberated the late bound regions of function signatures, so