-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Improve documentation for built-in macros #62243
Conversation
r? @aidanhs (rust_highfive has picked a reviewer for you, use r? to override) |
r? @eddyb |
@@ -4008,7 +4008,7 @@ impl<'a> LoweringContext<'a> { | |||
let attrs = self.lower_attrs(&i.attrs); | |||
if let ItemKind::MacroDef(ref def) = i.node { | |||
if !def.legacy || attr::contains_name(&i.attrs, sym::macro_export) || | |||
attr::contains_name(&i.attrs, sym::rustc_doc_only_macro) { | |||
attr::contains_name(&i.attrs, sym::rustc_builtin_macro) { |
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.
Is this needed anymore? The macro_rules!
-> macro
change would mean !def.legacy
is now true
.
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.
No, this is no longer needed (UPD: for libcore, it's still needed for libstd).
@@ -410,7 +410,7 @@ mod builtin { | |||
/// | |||
/// [`panic!`]: ../std/macro.panic.html | |||
#[stable(feature = "compile_error_macro", since = "1.20.0")] | |||
#[rustc_doc_only_macro] | |||
#[rustc_builtin_macro] | |||
macro_rules! compile_error { |
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.
Oh, these are unchanged. What needs to happen before these can just be reexports of the libcore
ones?
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.
rustc_builtin_macro
stubs acting like the real macros.
#62086 removes the duplicate macros from libstd, but also pub use
s their libcore versions from libstd's root (for documentation).
...And stub macros pub use
d in libstd root break all the dependent crates that inject #[macro_use] extern crate std
during rustdoc build.
Alternatively, some doc
attribute for selectively documenting private items would also solve the problem (pub use
could be replaced with #[doc(force)] use
then).
src/libsyntax/feature_gate.rs
Outdated
(sym::rustc_allow_const_fn_ptr, Whitelisted, template!(Word), Gated(Stability::Unstable, | ||
sym::rustc_attrs, | ||
"internal implementation detail", | ||
cfg_fn!(rustc_attrs))), |
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.
Oh, you whitelisted all the existing rustc_*
attributes?
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.
@bors r+ |
📌 Commit c959d7338b3f47bcbdc89f75cdf357c6b3e2f0df has been approved by |
☔ The latest upstream changes (presumably #62419) made this pull request unmergeable. Please resolve the merge conflicts. |
@bors r=eddyb |
📌 Commit 848b2d2 has been approved by |
Ugh, unstable diagnostic output. |
Order in which @bors r=eddyb |
📌 Commit 3274507 has been approved by |
Improve documentation for built-in macros This is the `libcore` part of rust-lang#62086. Right now the only effect is improved documentation. The changes in the last few commits are required to make the `libcore` change compile successfully.
Rollup of 6 pull requests Successful merges: - #60081 (Refactor unicode.py script) - #61862 (Make the Weak::{into,as}_raw methods) - #62243 (Improve documentation for built-in macros) - #62422 (Remove some uses of mem::uninitialized) - #62432 (Update rustfmt to 1.3.2) - #62436 (normalize use of backticks/lowercase in compiler messages for librustc_mir) Failed merges: r? @ghost
Improve documentation for built-in macros This is the `libcore` part of rust-lang#62086. Right now the only effect is improved documentation. The changes in the last few commits are required to make the `libcore` change compile successfully.
Rollup of 5 pull requests Successful merges: - #60081 (Refactor unicode.py script) - #61862 (Make the Weak::{into,as}_raw methods) - #62243 (Improve documentation for built-in macros) - #62422 (Remove some uses of mem::uninitialized) - #62436 (normalize use of backticks/lowercase in compiler messages for librustc_mir) Failed merges: r? @ghost
@bors r- |
@bors retry |
This is the
libcore
part of #62086.Right now the only effect is improved documentation.
The changes in the last few commits are required to make the
libcore
change compile successfully.