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

Implement SMIR generic parameter instantiation #115532

Merged
merged 7 commits into from
Sep 6, 2023

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Sep 4, 2023

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.

@rustbot
Copy link
Collaborator

rustbot commented Sep 4, 2023

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 (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 4, 2023
@rustbot
Copy link
Collaborator

rustbot commented Sep 4, 2023

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

This PR changes Stable MIR

cc @oli-obk, @celinval, @spastorino

@petrochenkov
Copy link
Contributor

r? @compiler-errors

@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Sep 5, 2023

📌 Commit c1e449c has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 5, 2023
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Sep 5, 2023
…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.
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 5, 2023
…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
@bors
Copy link
Contributor

bors commented Sep 5, 2023

☔ The latest upstream changes (presumably #115579) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 5, 2023
@oli-obk
Copy link
Contributor Author

oli-obk commented Sep 6, 2023

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Sep 6, 2023

📌 Commit 0f4ff52 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 6, 2023
@bors
Copy link
Contributor

bors commented Sep 6, 2023

⌛ Testing commit 0f4ff52 with merge c1d80ba...

@bors
Copy link
Contributor

bors commented Sep 6, 2023

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing c1d80ba to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 6, 2023
@bors bors merged commit c1d80ba into rust-lang:master Sep 6, 2023
12 checks passed
@rustbot rustbot added this to the 1.74.0 milestone Sep 6, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c1d80ba): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.5% [-2.5%, -2.5%] 1
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 627.653s -> 627.8s (0.02%)
Artifact size: 317.81 MiB -> 317.88 MiB (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)
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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(_),
) => {}
Copy link
Member

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? :)

Copy link
Contributor Author

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 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants