about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAntoni Boucher <bouanto@zoho.com>2024-04-19 20:57:40 -0400
committerAntoni Boucher <bouanto@zoho.com>2024-04-19 20:57:40 -0400
commit9b628f8e82dfb02bf6870624eb4acdca7a20947e (patch)
treef2ae8e3e6a55a16c9eb76578b26ea81c1f5e2e82 /src
parentab7d138d1675939bd87ad9bd14bf1fc78d41edcd (diff)
downloadrust-9b628f8e82dfb02bf6870624eb4acdca7a20947e.tar.gz
rust-9b628f8e82dfb02bf6870624eb4acdca7a20947e.zip
Fix panic when calling get_fn for a variable
Diffstat (limited to 'src')
-rw-r--r--src/context.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/context.rs b/src/context.rs
index 1b9cfd3652c..d04c7532b3c 100644
--- a/src/context.rs
+++ b/src/context.rs
@@ -432,6 +432,8 @@ impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
 
         let func = if self.intrinsics.borrow().contains_key(func_name) {
             self.intrinsics.borrow()[func_name]
+        } else if let Some(variable) = self.get_declared_value(func_name) {
+            return variable;
         } else {
             get_fn(self, instance)
         };