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

Should format_args_nl! be #[doc(hidden)] ? #93904

Closed
SimonSapin opened this issue Feb 11, 2022 · 8 comments · Fixed by #93930
Closed

Should format_args_nl! be #[doc(hidden)] ? #93904

SimonSapin opened this issue Feb 11, 2022 · 8 comments · Fixed by #93930
Assignees
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. Libs-Small Libs issues that are considered "small" or self-contained T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@SimonSapin
Copy link
Contributor

SimonSapin commented Feb 11, 2022

Initial title: format_args_nl! should link to format_args! where they mention it


https://doc.rust-lang.org/nightly/std/macro.format_args_nl.html currently contains:

Same as format_args, but adds a newline in the end.

It would be nicer as:

Same as format_args, but adds a newline in the end.

… although I also find #87410 which made it #[doc(hidden)]. It looks like that was undone at some point?

@SimonSapin SimonSapin added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. T-libs Relevant to the library team, which will review and decide on the PR/issue. Libs-Small Libs issues that are considered "small" or self-contained labels Feb 11, 2022
@name1e5s
Copy link
Contributor

It seems that #[doc(hidden)] is removed in #92456

@name1e5s
Copy link
Contributor

@rustbot claim

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 12, 2022
add link to format_args! when mention it in docs

close rust-lang#93904
@bors bors closed this as completed in 2b7f3ee Feb 13, 2022
@SimonSapin
Copy link
Contributor Author

It seems that #[doc(hidden)] is removed in #92456

Was it intentional, though? The PR description says

use ::std::prelude::v1::derive; compiles on stable, so, AFAIK, there is no reason to have it be #[doc(hidden)].

But that does not apply to format_args_nl which has:

    #[unstable(
        feature = "format_args_nl",
        issue = "none",
        reason = "`format_args_nl` is only for internal \
                  language use and is subject to change"
    )]

CC @danielhenrymantilla

@SimonSapin SimonSapin reopened this Feb 13, 2022
@SimonSapin SimonSapin changed the title format_args_nl! docs should link to format_args! where they mention it Should format_args_nl! be #[doc(hidden)] ? Feb 13, 2022
@danielhenrymantilla
Copy link
Contributor

danielhenrymantilla commented Feb 14, 2022

After some discussion in that PR, it was deemed that a macro being unstable did not warrant, on its own, marking the macro as #[doc(hidden)]. Hence why a bunch of such macros were unhidden by that PR, but maybe format_args_nl! shouldn't have been part of those?

I really don't have a strong opinion here myself, so lemme wash my hands 😄, but:

  • on the one hand, I do lean towards not hiding, in general, some of these unstable macros since it may reduce a bit too much their discoverability.

  • on the other hand, I'll grant that there is a difference, alas quite subtle / currently hard-to-express, between unstable-and-expected-to-eventually-be-stabilized, and perma-unstable; for the latter it seems more legitimate to mark them as #[doc(hidden)].

    Given the description of the unstability of format_args_nl, it seems like it's the latter?

🤷

@SimonSapin
Copy link
Contributor Author

“On its own” is important here.

#[unstable] is used for two categories of APIs:

  • Those that are not stable yet, but have a tracking issue and might become stable at some point
  • The "perma-unstable" APIs, that ideally should be private to a crate but need to be public typically to let some other standard library crate use them.

I think that depending on its category each item with #[unstable] should either point to a tracking issue, or be #[doc(hidden)]. Here “only for internal language use” seems to point to the latter.

@danielhenrymantilla
Copy link
Contributor

danielhenrymantilla commented Feb 15, 2022

Yeah, I share the feeling: AFAIC, feel free to go and make it #[doc(hidden)] again then

@raindev
Copy link
Contributor

raindev commented May 25, 2022

One potential argument against hiding the macro from the docs is that it shows up in the compiler errors originating from the use of format strings (i.e. "note: this error originates in the macro $crate::format_args_nl"). Having it surfaced to the user this way but hidden from the docs might not be great.

@jyn514
Copy link
Member

jyn514 commented Jun 20, 2022

This is being stabilized in #97658, so I think the answer is pretty clearly "no" now (but the discussion here is interesting for other perma-unstable macros).

@jyn514 jyn514 closed this as completed Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. Libs-Small Libs issues that are considered "small" or self-contained T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants