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

Doc alias name restriction #76811

Merged
merged 4 commits into from
Oct 2, 2020

Conversation

GuillaumeGomez
Copy link
Member

Fixes #76705.

@rust-highfive
Copy link
Collaborator

r? @oli-obk

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 16, 2020
@GuillaumeGomez
Copy link
Member Author

cc @Mark-Simulacrum (since you commented on the issue ;) )

r? @ollie27

@rust-highfive rust-highfive assigned ollie27 and unassigned oli-obk Sep 16, 2020
@pickfire
Copy link
Contributor

Should be show the list of stuff not allowed in the name?

@jyn514 jyn514 added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Sep 17, 2020
@GuillaumeGomez GuillaumeGomez force-pushed the doc-alias-name-restriction branch from 0a399e6 to 1c19913 Compare September 17, 2020 18:18
@GuillaumeGomez
Copy link
Member Author

Updated!

@jyn514 jyn514 added the A-doc-alias Area: `#[doc(alias)]` label Sep 27, 2020
}
if let Some(c) = doc_alias
.chars()
.find(|&c| c == '"' || c == ' ' || c == '\t' || c == '\r' || c == '\n')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.find(|&c| c == '"' || c == ' ' || c == '\t' || c == '\r' || c == '\n')
.find(|&c| c == '"' || c.is_whitespace())

@oli-obk
Copy link
Contributor

oli-obk commented Oct 2, 2020

Just a nit. r=me with that

@GuillaumeGomez GuillaumeGomez force-pushed the doc-alias-name-restriction branch from 1c19913 to 63bda19 Compare October 2, 2020 15:41
@GuillaumeGomez
Copy link
Member Author

@bors: r=oli-obk

@bors
Copy link
Contributor

bors commented Oct 2, 2020

📌 Commit 63bda197a32322e577e152e42973ef9852bf75df has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 2, 2020
@ollie27
Copy link
Member

ollie27 commented Oct 2, 2020

Single quotes can also be used for exact search:

if ((val.charAt(0) === "\"" || val.charAt(0) === "'") &&

Assuming that's the reason to disallow double quotes then surely we shouldn't allow single quotes as well?

If you search for an alias surrounded by quotes: https://doc.rust-lang.org/nightly/std/?search=%22reduce%22 then the alias doesn't show up in the results. Is that a bug?

@GuillaumeGomez
Copy link
Member Author

GuillaumeGomez commented Oct 2, 2020

@ollie27: I wrote this code and yet I didn't remember that... Not very serious of me haha. Great catch, thanks!

If you search for an alias surrounded by quotes: https://doc.rust-lang.org/nightly/std/?search=%22reduce%22 then the alias doesn't show up in the results. Is that a bug?

It's for exact search, so if nothing is named "reduce", it won't return anything.

@bors: r-

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 2, 2020
@GuillaumeGomez GuillaumeGomez force-pushed the doc-alias-name-restriction branch from 63bda19 to 4427b2d Compare October 2, 2020 17:27
@GuillaumeGomez
Copy link
Member Author

@bors: r=oli-obk,ollie27

@bors
Copy link
Contributor

bors commented Oct 2, 2020

📌 Commit 4427b2d has been approved by oli-obk,ollie27

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 2, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 2, 2020
…as-schievink

Rollup of 12 pull requests

Successful merges:

 - rust-lang#76101 (Update RELEASES.md for 1.47.0)
 - rust-lang#76739 (resolve: prohibit anon const non-static lifetimes)
 - rust-lang#76811 (Doc alias name restriction)
 - rust-lang#77405 (Add tracking issue of iter_advance_by feature)
 - rust-lang#77409 (Add example for iter chain struct)
 - rust-lang#77415 (Better error message for `async` blocks in a const-context)
 - rust-lang#77423 (Add `-Zprecise-enum-drop-elaboration`)
 - rust-lang#77432 (Use posix_spawn on musl targets)
 - rust-lang#77441 (Fix AVR stack corruption bug)
 - rust-lang#77442 (Clean up on example doc fixes for ptr::copy)
 - rust-lang#77444 (Fix span for incorrect pattern field and add label)
 - rust-lang#77453 (Stop running macOS builds on Azure Pipelines)

Failed merges:

r? `@ghost`
@bors bors merged commit c7c2418 into rust-lang:master Oct 2, 2020
@rustbot rustbot added this to the 1.48.0 milestone Oct 2, 2020
@GuillaumeGomez GuillaumeGomez deleted the doc-alias-name-restriction branch October 2, 2020 22:52
@lopopolo
Copy link
Contributor

lopopolo commented Oct 3, 2020

This issue doesn't say why the restriction on whitespace characters was added, but I'd like to share why I was using whitespace characters in doc aliases.

My code has a public Mt struct. Mt is a random number generator that implements the MT19937 mersenne twister. I want to alias this struct to mersenne twister and Mersenne twister.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-doc-alias Area: `#[doc(alias)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clean up doc_alias feature
9 participants