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

Reexport MetadataBlob so it can be used in rustc plugins #108435

Closed

Conversation

GuillaumeGomez
Copy link
Member

I was investigating on #81893. Currently, if a pub use of a foreign item has documentation, it's apparently not saved in the rmeta. However, I'm not completely sure of that so I wanted to look into the rmeta file to check if I missed anything, but I couldn't find a rmeta reader, so I started writing my own (the work in progress of this fix can be seen here).

You can see the very beginning of this rmeta reader here. Not working at the moment and I can't find out how to make rust-toolchain and its path argument work for rustc crates at the moment (if you have an idea?).

Anyway, hopefully this will be helpful for other rustc contributors. At least it'll be for me. :)

cc @lqd

@rustbot
Copy link
Collaborator

rustbot commented Feb 24, 2023

r? @petrochenkov

(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 Feb 24, 2023
@petrochenkov
Copy link
Contributor

-1 on this.

  • Reading binary contents of MetadataBlob is not very useful (and can be done with debugger or debug printing instead of a standalone tool).
  • Reading anything more useful will require reexporting many more methods from rustc_metadata.
  • Even if more methods are reexported this tool will break often due to changing interfaces, and will probably never be used outside of this specific debugging session anyway.

@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 Feb 27, 2023
@GuillaumeGomez
Copy link
Member Author

Considering we are currently running an effort on reducing the size of meta data, it'll be used more than once. For the rest, considering I can't test anything at the time, you're very likely right, more things will need to be reexported.

Reading binary contents of MetadataBlob is not very useful (and can be done with debugger or debug printing instead of a standalone tool).

Again, I need to have access to more of the code to be able to know what I need. But if you suggest more globally to just debug print everything, that sounds like a terrible approach to the whole problem.

Even if more methods are reexported this tool will break often due to changing interfaces, and will probably never be used outside of this specific debugging session anyway.

Well, it's the same for all plugins, so nothing new here. Luckily we can pin a specific version so it reduces the problem by quite a lot.

@petrochenkov
Copy link
Contributor

I suggest making something more developed than https://github.com/GuillaumeGomez/rmeta-reader/blob/master/src/main.rs with a rustc branch/fork. When the tool produces some useful output it will become more clear what parts of rustc_metadata are required for that.

@bors
Copy link
Contributor

bors commented May 17, 2023

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

@JohnCSimon
Copy link
Member

@GuillaumeGomez
ping from triage - can you post your status on this PR? There hasn't been an update in a few months. Thanks!

@GuillaumeGomez
Copy link
Member Author

Forgot about it. I'm planning to go back on it so closing.

@GuillaumeGomez GuillaumeGomez deleted the reexport-metadatablob branch December 17, 2023 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

5 participants