From bcfa0219e2b3410eeb5774b28559a26fc9ee938b Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Mon, 29 Apr 2024 14:23:14 -0600 Subject: [PATCH] detect External indices more generally in internalize_constant (#2395) --- build/instructions_template.rs | 7 +++++++ src/indexing.rs | 12 ++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/build/instructions_template.rs b/build/instructions_template.rs index 7914964f..86cde2f3 100644 --- a/build/instructions_template.rs +++ b/build/instructions_template.rs @@ -1017,6 +1017,13 @@ fn generate_instruction_preface() -> TokenStream { }, } } + + pub fn is_external(&self) -> bool { + matches!( + self, + IndexingCodePtr::External(_) | IndexingCodePtr::DynamicExternal(_) + ) + } } impl IndexingInstruction { diff --git a/src/indexing.rs b/src/indexing.rs index 4eb39e2d..2df05530 100644 --- a/src/indexing.rs +++ b/src/indexing.rs @@ -114,13 +114,13 @@ impl<'a> IndexingCodeMergingPtr<'a> { Some(OptArgIndexKey::Literal(_, _, constant, _)) => { constants.insert(*constant, constant_ptr); } + _ if constant_ptr.is_external() => { + // this must be a defunct clause, because it's been deleted + // from the skeleton. + debug_assert!(constant_key.is_none()); + } _ => { - if let IndexingCodePtr::DynamicExternal(_) = constant_ptr { - // this must be a defunct clause, because it's been deleted - // from the skeleton. - } else { - unreachable!() - } + unreachable!() } } -- 2.54.0