-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Rustdoc JSON: Invalid output for core
#106435
Comments
Hi all, is this issue beginner-friendly? I'd like to tackle this, but I'm new-ish to Rust (the language) and completely new to the Rust project, so I'm not sure whether it's efficient for you to guide me where necessary. Anyway, I managed to follow the instructions and reproduce the issue. The first culprit I found is the What's the right way to fix this: Adjusting the types, or the generation of If the types need to be adjusted I could provide a PR. If |
Here some details for the
@@ -336,13 +336,14 @@ pub struct Enum {
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct Variant {
/// Whether the variant is plain, a tuple-like, or struct-like. Contains the fields.
- pub kind: VariantKind,
+ #[serde(flatten)]
+ pub variant_kind: VariantKind,
/// The discriminant, if explicitly specified.
pub discriminant: Option<Discriminant>,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
-#[serde(rename_all = "snake_case")]
+#[serde(tag = "variant_kind", content = "variant_inner", rename_all = "snake_case")]
pub enum VariantKind {
/// A variant with no parentheses
/// With these fixes in place another issue pops up: a The type specifies the contents in
"inner": {
"variant_kind": "struct",
"variant_inner": {
"expr": "1",
"value": "1"
}
} |
I'm not sure, but I'd be happy to answer questions you have, either here or (preferably) on rust zulip (in the rustdoc channel) |
How are you generating |
Hi @aDotInTheVoid, thanks for your replies. Happy to continue the conv on Zulip once I know how ;-) I'm on ddad1e1, so #106354 is included, and |
Hmmm, #106354 bumped If you want to use zulip, https://forge.rust-lang.org/platforms/zulip.html describes how to get on it. |
Could somebody point me to how you get a json rustdoc for the core crates? |
@makspll See the comment at the top of this issue. |
Ah, guessing there is no way to use rustdoc directly to get these, for anybody looking: rustup component add --toolchain <toolchain> rust-docs-json
ls ~/.rustup/toolchains/<toolchain>-x86_64-unknown-linux-gnu/share/doc/rust/json/ does the job |
Running
Outputs a large number of errors
pub use
ing#[doc(hidden)]
items. #106379#[doc(hidden)]
mod #112852#[doc(hidden)]
#106538Originally posted by @aDotInTheVoid in #104064 (comment)
The text was updated successfully, but these errors were encountered: