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

Extend -Zdump-mir output with two-phase borrow info #105815

Closed
wants to merge 3 commits into from

Conversation

pnkfelix
Copy link
Member

This should cause no breakage since its just injecting a comment /*2pb*/ (and the -Zdump-mir output is unstable anyway).

@rustbot
Copy link
Collaborator

rustbot commented Dec 17, 2022

r? @lcnr

(rustbot has picked a reviewer for you, use r? to override)

@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 Dec 17, 2022
@lcnr
Copy link
Contributor

lcnr commented Dec 19, 2022

generally in favor even though the representation isn't great. I am not sure how long it would take me to figure out what /* 2pb */ means. Can't quickly think of a better alternative though '^^

r? @oli-obk

@rustbot rustbot assigned oli-obk and unassigned lcnr Dec 19, 2022
@oli-obk
Copy link
Contributor

oli-obk commented Dec 19, 2022

We could include more information in the // comments after the statement, by adding an arm for Rvalue::Ref in

fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) {

@pnkfelix
Copy link
Member Author

@oli-obk can you spell out how much more info you think you'd want? Right now this really is just a boolean flag, so the presence/absence of a tag like /*2pb*/ is all I could think of to include.

(Maybe you're saying you'd want to know about when the reservation begins versus when the exclusive access itself actually begins, which I would agree would be superior, but I do not think that information is directly reflected in the MIR structure, and I think I'd bias towards making the dump_mir output merely reflect existing structure rather than have it attempt further deductions in the dump_mir code itself...)

@pnkfelix
Copy link
Member Author

pnkfelix commented Dec 28, 2022

(I have been musing whether there would be value in having the MIR itself use general structure where every mutable borrow is modelled as a two-phase borrow, with distinct "reserve-mut" and "exercise-the-reservation" operations. But that is a huge change that would need far broader discussion.)

@oli-obk
Copy link
Contributor

oli-obk commented Jan 9, 2023

Right now this really is just a boolean flag, so the presence/absence of a tag like /*2pb*/ is all I could think of to include.

Oh, I don't mean more information, just clarifying what 2pb means in a comment, similar to how we have comments for constants giving their type and potentially verbose value

@oli-obk
Copy link
Contributor

oli-obk commented Jan 10, 2023

r=me with either the new comments added or not ^^

@rustbot author

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Jan 10, 2023
@JohnCSimon
Copy link
Member

@pnkfelix Ping from triage: Can you post your status on this PR? This has sat idle for a few months.

@JohnCSimon
Copy link
Member

@pnkfelix

Ping from triage: I'm closing this due to inactivity, Please reopen when you are ready to continue with this.
Note: if you are going to continue please open the PR BEFORE you push to it, else you won't be able to reopen - this is a quirk of github.
Thanks for your contribution.

@rustbot label: +S-inactive

@JohnCSimon JohnCSimon closed this Dec 17, 2023
@rustbot rustbot added the S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. label Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

None yet

5 participants