about summary refs log tree commit diff
diff options
context:
space:
mode:
authorantoyo <antoyo@users.noreply.github.com>2024-04-19 21:26:48 -0400
committerGitHub <noreply@github.com>2024-04-19 21:26:48 -0400
commit9941c3590dc6b80e94ab04ace330f6b95c8ac0fa (patch)
treed05f3b08d28f3d1a5f7a862b50b5822649ba5f08
parente26e7aeb9a785c8f7bf9318dd00905da9ab4e3b6 (diff)
parent9b628f8e82dfb02bf6870624eb4acdca7a20947e (diff)
downloadrust-9941c3590dc6b80e94ab04ace330f6b95c8ac0fa.tar.gz
rust-9941c3590dc6b80e94ab04ace330f6b95c8ac0fa.zip
Merge pull request #499 from rust-lang/fix/unreachable-in-get_fn
Fix panic when calling get_fn for a variable
-rw-r--r--src/context.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/context.rs b/src/context.rs
index d37fa7833fc..890b4b15fc0 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)
         };