Skip to content

Clean up doc_alias feature #76705

Description

@GuillaumeGomez

From this comment: #50146 (comment)

Still remaining the .replace().

Activity

  1. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    on Sep 14, 2020
  2. GuillaumeGomez commented on Sep 15, 2020

    @GuillaumeGomez
    MemberAuthor

    Actually, the " character has a meaning in the search (for "exact" search). But instead of just removing it, maybe we should instead emit an error when we encounter it. What do you think @ollie27 ?

  3. ollie27 commented on Sep 15, 2020

    @ollie27
    Contributor

    Actually, the " character has a meaning in the search (for "exact" search).

    That doesn't work for #[doc(alias = "...")] though, maybe it should?

    But instead of just removing it, maybe we should instead emit an error when we encounter it.

    It would make sense to restrict allowed characters because even whitespace is allowed at the moment which seems questionable.

  4. Mark-Simulacrum commented on Sep 15, 2020

    @Mark-Simulacrum
    Member

    It sounds like we need to make sure this lands before we branch beta or so?

  5. modified the milestones: 1.47.0, 1.48.0 on Sep 15, 2020
  6. GuillaumeGomez commented on Sep 16, 2020

    @GuillaumeGomez
    MemberAuthor

    Let's forbid ", whitespaces and tabs in the the doc alias then.

  7. Mark-Simulacrum commented on Sep 16, 2020

    @Mark-Simulacrum
    Member

    Can we avoid ad-hoc rules and say something like "must be a rust identifier"?

  8. GuillaumeGomez commented on Sep 16, 2020

    @GuillaumeGomez
    MemberAuthor

    Even better! Great suggestion @Mark-Simulacrum !

  9. GuillaumeGomez commented on Sep 16, 2020

    @GuillaumeGomez
    MemberAuthor

    Just thought about it, but it cannot be the case @Mark-Simulacrum : we allow things like "*" or "+" (for the traits for example), so it cannot be ident only. I'll stick to the listed characters above.

  10. Mark-Simulacrum commented on Sep 16, 2020

    @Mark-Simulacrum
    Member
  11. GuillaumeGomez commented on Sep 16, 2020

    @GuillaumeGomez
    MemberAuthor

    Doc aliases can be something else than a rust identifier. For example, you can look for & or + in the std docs, and you'll see aliases results.

  12. Mark-Simulacrum commented on Sep 16, 2020

    @Mark-Simulacrum
    Member

    Ah, I see what you mean. Okay, then I agree that we need more than just Rust identifiers, and it might be reasonable to just allow as you suggest -- everything except whitespace and quotes. I'm a bit worried that'll hurt us in terms of how expansive it is but it's probably fine.

  13. GuillaumeGomez commented on Sep 16, 2020

    @GuillaumeGomez
    MemberAuthor

    I don't expect #[doc(alias = "..."")] attributes to be used widely, so we should be fine. ;)

  14. lopopolo commented on Oct 3, 2020

    @lopopolo
    Contributor

    It would make sense to restrict allowed characters because even whitespace is allowed at the moment which seems questionable.

    Is there more justification for removing whitespace support other than calling the characters questionable? If I have a struct or a function that implements an algorithm, I would like to alias the item to the plaintext name of the algorithm, for example Mersenne twister.

  15. GuillaumeGomez commented on Oct 4, 2020

    @GuillaumeGomez
    MemberAuthor

    I just had in mind "idents", so no whitespace in them. However I don't see any reason to not allow ' ' specfically. I'll send a PR tomorrow.

  16. lopopolo commented on Oct 4, 2020

    @lopopolo
    Contributor

    rustdoc only being ident-centric is something that I wish would be improved.

    I wish that rustdoc search was for more than types and functions I already know the names of. I would hope that a search for "vector" would return Vec near the top instead of not at all.

  17. GuillaumeGomez commented on Oct 5, 2020

    @GuillaumeGomez
    MemberAuthor

    path-centric would be more accurate. ;)

  18. added a commit that references this issue on Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

A-doc-aliasArea: `#[doc(alias)]`T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions