-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Make the documentation of builtin macro attributes accessible #92456
Conversation
This is currently on a draft stage / |
See the FIXME above, It may be possible that those bugs are fixed now, in that case the |
This comment has been minimized.
This comment has been minimized.
Ah, wait, |
63ea92c
to
53925fb
Compare
@petrochenkov So, |
This is true for all other uses of |
So, |
Anything that is stable in the standard library should be fully documented
by the stdlib docs, imo. deprecated items are still stable.
…On Fri, Dec 31, 2021 at 09:50 Daniel Henry-Mantilla < ***@***.***> wrote:
So, #[global_allocator] and #[test] seem to be the only non-unstable non-
deprecated attributes in the same situation, so I'm gonna apply my
suggested change to those as well (whether unstable or deprecated ones
deserve to be "clickable" is another question).
—
Reply to this email directly, view it on GitHub
<#92456 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABGLD267EMO2IIARDZ5WXLDUTW7KFANCNFSM5LBHWOTQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
#[doc(hidden)]
the #[derive]
macro attribute#[doc(hidden)]
builtin stable macro attributes
#[doc(hidden)]
builtin stable macro attributes#[doc(hidden)]
builtin stable macro attributes (#[test]
, #[derive]
, …)
I'm on vacation. |
@chorman0773 I've implemented 2778d53 to apply your rationale, but, that being said, the only thing one can do with |
It's probably useful for implementors, at least for now, to know they exist. That being said, it may be reasonable to exempt them, especially if (as may be a good idea, although technically breaking) they eventually get removed/destabilzed (since they can't be used anyways). |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
3307b99
to
6c6753d
Compare
This comment has been minimized.
This comment has been minimized.
I'll now add another commit trying to have all macros documented, regardless of stability, except for |
#[doc(hidden)]
builtin stable macro attributes (#[test]
, #[derive]
, …)@@ -69,29 +68,26 @@ pub use crate::{ | |||
#[doc(no_inline)] | |||
pub use crate::concat_bytes; | |||
|
|||
// Do not `doc(inline)` these `doc(hidden)` items. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this comment make sense?
The items are hidden anyway, so it doesn't make any difference whether we inline them or not?
(Especially considering that doc(inline)
is the default in this situation.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc(inline)
is the default in this situation
So, while this is currently true, I have to admit having chosen not to use doc(inline)
explicitly since there is a change I've been considering to suggest to the rustdoc
team, which would change, at the very least, the same-crate re-export of a #[doc(hidden)]
item when not using #[doc(inline)]
.
For a crate wanting to feature macro_export
-ed macros scoped within a module, currently, there are three options:
-
pub mod module { #[macro_export] macro_rules! __m__ {() => ()} pub use __m__ as m; }
Drawback:
__m__!
is visible at the crate root.-
Workaround: use js hacks to hide it in the aftermath (an ugly example)
Drawback: so hacky and ugly.
-
-
Another solution: use a helper crate that performs the
#[macro_export]
s, and thenpub use
them in a scoped fashion from the frontend crate (an example).Drawback: on top of being more cumbersome, it breaks
$crate
.
The best solution for these things that occurred to me would be for #[doc(inline)]
to override #[doc(hidden)]
(or have a doc(inline_unhidden)
for this, but that seems to be way more work). Indeed, doc(inline)
expresses an intent to have the item be documented in situ, so it makes sense to have it express _unhidden
semantics as well, for the rare case where it could matter.
And this would be one such case, where we'd thus have not to use doc(inline)
. I thus find it less error-prone to do it this way, if that makes sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I don't want to dig too much into this.
r=me after squashing commits. |
- Do not `#[doc(hidden)]` the `#[derive]` macro attribute - Add a link to the reference section to `derive`'s inherent docs - Do the same for `#[test]` and `#[global_allocator]` - Fix `GlobalAlloc` link (why is it on `core` and not `alloc`?) - Try `no_inline`-ing the `std` reexports from `core` - Revert "Try `no_inline`-ing the `std` reexports from `core`" - Address PR review - Also document the unstable macros
070dc39
to
f20ccc0
Compare
@danielhenrymantilla: 🔑 Insufficient privileges: Not in reviewers |
@bors r=petrochenkov |
@danielhenrymantilla: 🔑 Insufficient privileges: Not in reviewers |
@bors r+ |
📌 Commit f20ccc0 has been approved by |
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#91754 (Modifications to `std::io::Stdin` on Windows so that there is no longer a 4-byte buffer minimum in read().) - rust-lang#91884 (Constify `Box<T, A>` methods) - rust-lang#92107 (Actually set IMAGE_SCN_LNK_REMOVE for .rmeta) - rust-lang#92456 (Make the documentation of builtin macro attributes accessible) - rust-lang#92507 (Suggest single quotes when char expected, str provided) - rust-lang#92525 (intra-doc: Make `Receiver::into_iter` into a clickable link) - rust-lang#92532 (revert rust-lang#92254 "Bump gsgdt to 0.1.3") Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
use ::std::prelude::v1::derive;
compiles on stable, so, AFAIK, there is no reason to have it be#[doc(hidden)]
.What it currently looks like for things such as
#[test]
,#[derive]
,#[global_allocator]
: https://doc.rust-lang.org/1.57.0/core/prelude/v1/index.html#:~:text=Experimental-,pub,-use%20crate%3A%3Amacros%3A%3Abuiltin%3A%3Aglobal_allocatorand in
::std
they're just straighthidden
.Here is how it looks like with this PR (assuming the
Rustc{De,En}codable
ones are not reverted):Since this involves doc people to chime in, and since
jyn
is on vacation, I'll cc @GuillaumeGomez and tag therustdoc
team as well