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

Make fields of mir::Terminator public #15270

Merged
merged 1 commit into from Jul 13, 2023
Merged

Conversation

ChristianSchott
Copy link
Contributor

When trying to use the RA crate, I am unable to access the fields in hir_def::mir::Terminator.
I don't see any reason, why these should be private, especially as the fields of hir_def::mir::Statement are pub.

I am not sure if the fields in hir_def::mir::SwitchTargets should be made pub too, but at least they are read-accessible via some public methods..

Sorry if I missed something, this is my first PR.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 12, 2023
@HKalbasi
Copy link
Member

This makes sense, I will merge it when bors becomes online. About SwitchTargets since it is exact copy of rustc and there were private there and methods are enough, let's keep them private.

But note that there is no stability guarantees no where in rust-analyzer crates, and things will specially break in mir since it is a work in progress. By the way, what is your use case?

@ChristianSchott
Copy link
Contributor Author

@HKalbasi Sounds good! No worries, I am aware about the stability of MIR.. the original plan was to access the rustc-mir directly, but that seemed a lot harder and also unstable. So your work on integrating MIR in RA is already a big time safe!
I am trying to create a borrow/lifetime visualization tool similar to RustViz (https://github.com/rustviz/rustviz, but without the need for manual annotations) for making learning Rust easier.. but don't expect too much, I am still very new to Rust myself ^^

@HKalbasi
Copy link
Member

Interesting. If you got some where, it might also be possible to merge it in rust-analyzer for easier use and better discoverability. Also note that r-a mir has probably some bugs relative to rustc's, please report if you hit them.

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 13, 2023

📌 Commit 8f612b5 has been approved by HKalbasi

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jul 13, 2023

⌛ Testing commit 8f612b5 with merge f6ae0c1...

@bors
Copy link
Collaborator

bors commented Jul 13, 2023

☀️ Test successful - checks-actions
Approved by: HKalbasi
Pushing f6ae0c1 to master...

@bors bors merged commit f6ae0c1 into rust-lang:master Jul 13, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants