-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Implement SMIR generic parameter instantiation #115532
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. This PR changes Stable MIR cc @oli-obk, @celinval, @spastorino |
@bors r+ |
…rors Implement SMIR generic parameter instantiation Also demonstrates the use of it with a test. This required a few smaller changes that may conflict with `@ericmarkmartin` work, but should be easy to resolve any conflicts on my end if their stuff lands first.
…iaskrgr Rollup of 3 pull requests Successful merges: - rust-lang#114794 (clarify safety documentation of ptr::swap and ptr::copy) - rust-lang#115397 (Add support to return value in StableMIR interface and not crash due to compilation error) - rust-lang#115559 (implied bounds: do not ICE on unconstrained region vars) Failed merges: - rust-lang#115532 (Implement SMIR generic parameter instantiation) r? `@ghost` `@rustbot` modify labels: rollup
☔ The latest upstream changes (presumably #115579) made this pull request unmergeable. Please resolve the merge conflicts. |
@bors r=compiler-errors |
☀️ Test successful - checks-actions |
Finished benchmarking commit (c1d80ba): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 627.653s -> 627.8s (0.02%) |
@@ -103,8 +103,13 @@ impl<'tcx> Context for Tables<'tcx> { | |||
} | |||
|
|||
fn ty_kind(&mut self, ty: crate::stable_mir::ty::Ty) -> TyKind { | |||
let ty = self.types[ty.0]; | |||
ty.stable(self) | |||
self.types[ty.0].clone().stable(self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this clone now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just a Ty<'tcx>
, so we should probably copy it.
The reason we need it is that stable
takes self
by mutable reference, while we immutably borrow from self
via the index operations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I got this wrong. We need to clone the TyKind
in case it comes out of a MaybeStable::Stable
entry of self.types
. Sometimes SMIR creates its own types, and they get interned that way.
) => {} | ||
stable_mir::ty::TyKind::RigidTy( | ||
stable_mir::ty::RigidTy::Tuple(_), | ||
) => {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't be better to assert as way to show what are we trying to prove? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, but that was harder to do 😆
Also demonstrates the use of it with a test.
This required a few smaller changes that may conflict with @ericmarkmartin work, but should be easy to resolve any conflicts on my end if their stuff lands first.