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

rustdoc: deprecate #![doc(no_default_passes)], #![doc(passes "...")], #![doc(plugins = "...")] #48164

Closed
QuietMisdreavus opened this issue Feb 12, 2018 · 0 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@QuietMisdreavus
Copy link
Member

QuietMisdreavus commented Feb 12, 2018

While digging around in librustdoc, i found this little nugget:

rust/src/librustdoc/lib.rs

Lines 593 to 610 in 16362c7

for attr in krate.module.as_ref().unwrap().attrs.lists("doc") {
let name = attr.name().map(|s| s.as_str());
let name = name.as_ref().map(|s| &s[..]);
if attr.is_word() {
if name == Some("no_default_passes") {
default_passes = false;
}
} else if let Some(value) = attr.value_str() {
let sink = match name {
Some("passes") => &mut passes,
Some("plugins") => &mut plugins,
_ => continue,
};
for p in value.as_str().split_whitespace() {
sink.push(p.to_string());
}
}
}

What this does is handle the #![doc(no_default_passes)], #![doc(passes "...")], and #![doc(plugins = "...")] attributes the same way as the --no-defaults, --passes, and --plugins CLI flags. It would be useful to provide an analogue to --document-private-items and emit deprecation warnings for these attributes, as part of deprecating passes and plugins generally.

@QuietMisdreavus QuietMisdreavus added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-dev-tools-rustdoc labels Feb 12, 2018
@TimNN TimNN added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Feb 13, 2018
kennytm added a commit to kennytm/rust that referenced this issue May 16, 2018
…=GuillaumeGomez

rustdoc: deprecate `#![doc(passes, plugins, no_default_passes)]`

Closes rust-lang#48164

Blocked on rust-lang#50541 - this includes those changes, which were necessary to create the UI test

cc rust-lang#44136

Turns out, there were special attributes to mess with rustdoc passes and plugins! Who knew! Since we deprecated the CLI flags for this functionality, it makes sense that we do the same for the attributes.

This PR also introduces a `#![doc(document_private_items)]` attribute, to match the `--document-private-items` flag introduced in rust-lang#44138 when the passes/plugins flags were deprecated.

I haven't done a search to see whether these attributes are being used at all, but if the flags were any indication, i don't expect to see any users of these.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants