Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate stubbing transformation to be performed in the instance body #3072

Open
celinval opened this issue Mar 12, 2024 · 0 comments
Open

Migrate stubbing transformation to be performed in the instance body #3072

celinval opened this issue Mar 12, 2024 · 0 comments
Labels
[C] Internal Tracks some internal work. I.e.: Users should not be affected. [I] Refactoring / Clean Up Refactoring or cleaning up of existing code

Comments

@celinval
Copy link
Contributor

Proposed change:

Perform stubbing in the instance body instead of the generic one.

Motivation

This will simplify stubbing code, remove the redundant compilation and provide more precise error handling.

Background:

The stubbing transformation and validation are spread into multiple stages. The stubbing itself is done in the generic body by hijacking rustc's transformation query. Because of that, we have the following limitations:

  1. If the function being stubbed is generic, we delay the instantiation requirements validation to be done during the reachability analysis.
  2. We need to re-run the compilation for every set of stubs to invalidate the query cache and apply the right set of stubs.
  3. We have to override collect_and_partition_mono_items query to avoid an ICE related to the delayed validation of the instantiation requirements.

There is a downside though. Today, we are able to apply the stubs to concrete playback, which wouldn't be possible until changes to the StableMIR are visible to the rust compiler.

@celinval celinval added [C] Internal Tracks some internal work. I.e.: Users should not be affected. [I] Refactoring / Clean Up Refactoring or cleaning up of existing code labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Internal Tracks some internal work. I.e.: Users should not be affected. [I] Refactoring / Clean Up Refactoring or cleaning up of existing code
Projects
None yet
Development

No branches or pull requests

1 participant