fix(kompile): map linked NormalSym functions to monoItemFn(noBody)#953
Draft
fix(kompile): map linked NormalSym functions to monoItemFn(noBody)#953
Conversation
Linked NormalSym functions (external crate functions present in SMIR but without a local body) had no generated monoItemFn equation, falling back to "** UNKNOWN FUNCTION **". This synthesizes monoItemFn(symbol(...), defId(...), noBody) for all such symbols, ensuring downstream call resolution can find them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Synthesize
monoItemFn(symbol(...), defId(...), noBody)equations for linkedNormalSymfunctions that have no local body in the SMIRitemscollection.Context
When compiling multi-crate Rust programs, external crate functions are present in SMIR's
function_symbolsasNormalSymentries but do not appear in theitemslist (since they have no local MIR body). Thekompile.pyfunction table generator only iterated overitems, so these linked functions had no generatedmonoItemFnequation. At call resolution time,lookupFunction(Ty)fell back to"** UNKNOWN FUNCTION **", causing execution to get stuck.This is analogous to how miri handles extern functions — they are recognized as valid call targets even without a local body.
Without this fix, calling any external crate function produces:
With this fix, linked NormalSym functions are mapped to
monoItemFn(..., noBody), allowing call resolution to recognize them as valid (bodyless) function targets.Test plan
make test-integrationregression