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

Refactor handling of MIR bodies #765

Merged
merged 4 commits into from
May 4, 2023
Merged

Refactor handling of MIR bodies #765

merged 4 commits into from
May 4, 2023

Conversation

voidc
Copy link
Collaborator

@voidc voidc commented May 3, 2023

This enables translating const fns.

Comment on lines +42 to +46
pub struct BodyId {
def_id: LocalDefId,
pub promoted: Option<Promoted>,
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FINALLY, GOOD, THANKS. Incidentally, I've seen discussions about giving promoteds their own DefIds but this is good.

) -> CreusotResult<(PreSignature<'tcx>, fmir::Body<'tcx>)> {
let func_translator = BodyTranslator::build_context(ctx.tcx, ctx, &body, parent);
let body = ctx.body(body_id).clone();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish we didn't have to clone the body here but if that turns out to be a perf issue later, we can always either wrap it in an Rc or use interior mutability in ctx like rustc does.

@xldenis
Copy link
Collaborator

xldenis commented May 4, 2023

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants