-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Changes from all commits
15042a3
22d6d8a
ab112ca
987be89
920a17a
3274507
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
#62086 removes the duplicate macros from libstd, but also Alternatively, some |
||
($msg:expr) => ({ /* compiler built-in */ }); | ||
($msg:expr,) => ({ /* compiler built-in */ }); | ||
|
@@ -462,7 +462,7 @@ mod builtin { | |
/// assert_eq!(s, format!("hello {}", "world")); | ||
/// ``` | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[rustc_doc_only_macro] | ||
#[rustc_builtin_macro] | ||
macro_rules! format_args { | ||
($fmt:expr) => ({ /* compiler built-in */ }); | ||
($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ }); | ||
|
@@ -500,7 +500,7 @@ mod builtin { | |
/// error: what's that?! | ||
/// ``` | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[rustc_doc_only_macro] | ||
#[rustc_builtin_macro] | ||
macro_rules! env { | ||
($name:expr) => ({ /* compiler built-in */ }); | ||
($name:expr,) => ({ /* compiler built-in */ }); | ||
|
@@ -526,7 +526,7 @@ mod builtin { | |
/// println!("the secret key might be: {:?}", key); | ||
/// ``` | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[rustc_doc_only_macro] | ||
#[rustc_builtin_macro] | ||
macro_rules! option_env { | ||
($name:expr) => ({ /* compiler built-in */ }); | ||
($name:expr,) => ({ /* compiler built-in */ }); | ||
|
@@ -557,7 +557,7 @@ mod builtin { | |
/// # } | ||
/// ``` | ||
#[unstable(feature = "concat_idents_macro", issue = "29599")] | ||
#[rustc_doc_only_macro] | ||
#[rustc_builtin_macro] | ||
macro_rules! concat_idents { | ||
($($e:ident),+) => ({ /* compiler built-in */ }); | ||
($($e:ident,)+) => ({ /* compiler built-in */ }); | ||
|
@@ -579,7 +579,7 @@ mod builtin { | |
/// assert_eq!(s, "test10btrue"); | ||
/// ``` | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[rustc_doc_only_macro] | ||
#[rustc_builtin_macro] | ||
macro_rules! concat { | ||
($($e:expr),*) => ({ /* compiler built-in */ }); | ||
($($e:expr,)*) => ({ /* compiler built-in */ }); | ||
|
@@ -607,7 +607,7 @@ mod builtin { | |
/// println!("defined on line: {}", current_line); | ||
/// ``` | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[rustc_doc_only_macro] | ||
#[rustc_builtin_macro] | ||
macro_rules! line { () => ({ /* compiler built-in */ }) } | ||
|
||
/// Expands to the column number at which it was invoked. | ||
|
@@ -632,7 +632,7 @@ mod builtin { | |
/// println!("defined on column: {}", current_col); | ||
/// ``` | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[rustc_doc_only_macro] | ||
#[rustc_builtin_macro] | ||
macro_rules! column { () => ({ /* compiler built-in */ }) } | ||
|
||
/// Expands to the file name in which it was invoked. | ||
|
@@ -656,7 +656,7 @@ mod builtin { | |
/// println!("defined in file: {}", this_file); | ||
/// ``` | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[rustc_doc_only_macro] | ||
#[rustc_builtin_macro] | ||
macro_rules! file { () => ({ /* compiler built-in */ }) } | ||
|
||
/// Stringifies its arguments. | ||
|
@@ -675,7 +675,7 @@ mod builtin { | |
/// assert_eq!(one_plus_one, "1 + 1"); | ||
/// ``` | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[rustc_doc_only_macro] | ||
#[rustc_builtin_macro] | ||
macro_rules! stringify { ($($t:tt)*) => ({ /* compiler built-in */ }) } | ||
|
||
/// Includes a utf8-encoded file as a string. | ||
|
@@ -709,7 +709,7 @@ mod builtin { | |
/// | ||
/// Compiling 'main.rs' and running the resulting binary will print "adiós". | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[rustc_doc_only_macro] | ||
#[rustc_builtin_macro] | ||
macro_rules! include_str { | ||
($file:expr) => ({ /* compiler built-in */ }); | ||
($file:expr,) => ({ /* compiler built-in */ }); | ||
|
@@ -746,7 +746,7 @@ mod builtin { | |
/// | ||
/// Compiling 'main.rs' and running the resulting binary will print "adiós". | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[rustc_doc_only_macro] | ||
#[rustc_builtin_macro] | ||
macro_rules! include_bytes { | ||
($file:expr) => ({ /* compiler built-in */ }); | ||
($file:expr,) => ({ /* compiler built-in */ }); | ||
|
@@ -770,7 +770,7 @@ mod builtin { | |
/// test::foo(); | ||
/// ``` | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[rustc_doc_only_macro] | ||
#[rustc_builtin_macro] | ||
macro_rules! module_path { () => ({ /* compiler built-in */ }) } | ||
|
||
/// Evaluates boolean combinations of configuration flags at compile-time. | ||
|
@@ -794,7 +794,7 @@ mod builtin { | |
/// }; | ||
/// ``` | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[rustc_doc_only_macro] | ||
#[rustc_builtin_macro] | ||
macro_rules! cfg { ($($cfg:tt)*) => ({ /* compiler built-in */ }) } | ||
|
||
/// Parses a file as an expression or an item according to the context. | ||
|
@@ -837,7 +837,7 @@ mod builtin { | |
/// Compiling 'main.rs' and running the resulting binary will print | ||
/// "🙈🙊🙉🙈🙊🙉". | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[rustc_doc_only_macro] | ||
#[rustc_builtin_macro] | ||
macro_rules! include { | ||
($file:expr) => ({ /* compiler built-in */ }); | ||
($file:expr,) => ({ /* compiler built-in */ }); | ||
|
@@ -889,7 +889,7 @@ mod builtin { | |
/// assert!(a + b == 30, "a = {}, b = {}", a, b); | ||
/// ``` | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[rustc_doc_only_macro] | ||
#[rustc_builtin_macro] | ||
macro_rules! assert { | ||
($cond:expr) => ({ /* compiler built-in */ }); | ||
($cond:expr,) => ({ /* compiler built-in */ }); | ||
|
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 nowtrue
.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).