Skip to content

Lenient deserialization of all previous FORMAT_VERSIONs #37

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

Closed
Boscop opened this issue Oct 1, 2024 · 3 comments
Closed

Lenient deserialization of all previous FORMAT_VERSIONs #37

Boscop opened this issue Oct 1, 2024 · 3 comments
Labels
discussion wontfix This will not be worked on

Comments

@Boscop
Copy link

Boscop commented Oct 1, 2024

I was using the latest version of this crate to generate JSON rustdoc output, but there was a version mismatch with the format that rustdoc executable generated:
https://docs.rs/rustdoc-types/0.29.1/rustdoc_types/struct.Header.html
vs https://docs.rs/rustdoc-types/0.30.0/rustdoc_types/struct.FunctionHeader.html
because the workspace that I wanted to document was using an older nightly.

Is there a way to be able to deserialize ALL previous formats in the same executable that uses rustdoc-types?
Because I intend to distribute my executable / use the compiled executable on different machines, but if it invokes the rustdoc executable that's installed for the user, it might use a different FORMAT_VERSION.
And every workspace might be pinned to a different Rust nightly, so currently it requires source code modification every time I want to accommodate a different nightly in the workspace that I want to run it on :/

Even better:
Is there a way to invoke not the rustdoc executable but link to the crate so that the versions always match? 🙂

@aDotInTheVoid aDotInTheVoid added wontfix This will not be worked on discussion labels Oct 7, 2024
@aDotInTheVoid
Copy link
Member

Is there a way to be able to deserialize ALL previous formats in the same executable that uses rustdoc-types?

If you depend on every single version of rustdoc-types! (although we somehow don't have releases corresponding to some extremely old format versions (3, 4, 7), and I don't think this is worth fixing). You'll then need to write code such that it can handle multiple different types. This is do-able, but is a lot of investment.

Is there a way to invoke not the rustdoc executable but link to the crate so that the versions always match? 🙂

No, the only real interface into rustdoc is via the CLI. You could in theory link into librustdoc via #![feature(rustc_private)], but that's extreamly painful (as the API isn't set up at all for external use). It also doesn't solve your problems:

  1. You now need to build with the same version from rustc/rustdoc you linked, so the problem of unsupported nightly versions is still there for you.
  2. rustdoc dynamically links to librustc_driver and libLLVM, so the user still needs to have that version installed.

@aDotInTheVoid aDotInTheVoid closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2024
@Boscop
Copy link
Author

Boscop commented Oct 9, 2024

Ah..
But I can only depend on one version of a crate, unless I make a new wrapper crate for each version, right?

Which solution do you recommend?
I just need support for the most recent format versions (like always covering the last year or so).

@aDotInTheVoid
Copy link
Member

But I can only depend on one version of a crate, unless I make a new wrapper crate for each version, right?

Nope!

Which solution do you recommend?

Personally, latest nightly only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants