Fix NoneType error in rustdoc - #4159
Conversation
|
@krasimirgg @slackito do either of you know if this would break anything on Google's end? |
| require_explicit_unstable_features (bool): Whether to require all unstable features to be explicitly opted in to using `-Zallow-features=...`. | ||
| error_format (str, optional): Error format to pass to the `--error-format` command line argument. If set to None, uses the "_error_format" entry in `attr`. | ||
| allowed_unstable_rust_features (list, optional): List of unstable Rust language features allowed for this target. | ||
| emit_out_dir_flag (bool): Whether to emit `--out-dir=<crate_info.output.dirname>`. |
There was a problem hiding this comment.
I wonder if instead we could simulate this behavior by checking whether crate_info.output is a directory or a file? If I understand correctly, it's a directory if and only if we're in a rustdoc context, and it's exactly when we want to suppress emitting --out-dir?
There was a problem hiding this comment.
Done, now if output is a directory, we only emit --out-dir for that path but if it's a source we emit it for dirname.
we don't directly use the rustfmt aspect, but I'm not sure if we don't have other extensions that produce a CrateInfo with an empty output. Let me run a check about that... EDIT: ran a sample test, that bit looks OK. Left a comment about potentially simplifying the logic by sniffing if crate_info.output is a directory or not. |
slackito
left a comment
There was a problem hiding this comment.
Looks good to me. I'll report back if it breaks anything once we import it.
|
Actually I just raced with Krasimir and it turns out he had comments. Please address them before merging. |
There seemed to be a confusion around
CrateInfo.outputbeing optional within the rustdoc rules that leads to aNoneTypeerror when using rustdoc on a generated crate root:This change adds a proper output to satisfy the the current
CrateInfointerface.