Skip to content

Commit ce8e4e7

Browse files
committed
libcore documentation for builtin macros
1 parent e470827 commit ce8e4e7

File tree

1 file changed

+142
-0
lines changed

1 file changed

+142
-0
lines changed

src/libcore/macros.rs

+142
Original file line numberDiff line numberDiff line change
@@ -509,3 +509,145 @@ macro_rules! unreachable {
509509
macro_rules! unimplemented {
510510
() => (panic!("not yet implemented"))
511511
}
512+
513+
/// Built-in macros to the compiler itself.
514+
///
515+
/// These macros do not have any corresponding definition with a `macro_rules!`
516+
/// macro, but are documented here. Their implementations can be found hardcoded
517+
/// into libsyntax itself.
518+
///
519+
/// For more information, see documentation for `std`'s macros.
520+
#[cfg(dox)]
521+
pub mod builtin {
522+
/// The core macro for formatted string creation & output.
523+
///
524+
/// For more information, see the documentation for [`std::format_args!`].
525+
///
526+
/// [`std::format_args!`]: ../std/macro.format_args.html
527+
#[stable(feature = "rust1", since = "1.0.0")]
528+
#[macro_export]
529+
macro_rules! format_args { ($fmt:expr, $($args:tt)*) => ({
530+
/* compiler built-in */
531+
}) }
532+
533+
/// Inspect an environment variable at compile time.
534+
///
535+
/// For more information, see the documentation for [`std::env!`].
536+
///
537+
/// [`std::env!`]: ../std/macro.env.html
538+
#[stable(feature = "rust1", since = "1.0.0")]
539+
#[macro_export]
540+
macro_rules! env { ($name:expr) => ({ /* compiler built-in */ }) }
541+
542+
/// Optionally inspect an environment variable at compile time.
543+
///
544+
/// For more information, see the documentation for [`std::option_env!`].
545+
///
546+
/// [`std::option_env!`]: ../std/macro.option_env.html
547+
#[stable(feature = "rust1", since = "1.0.0")]
548+
#[macro_export]
549+
macro_rules! option_env { ($name:expr) => ({ /* compiler built-in */ }) }
550+
551+
/// Concatenate identifiers into one identifier.
552+
///
553+
/// For more information, see the documentation for [`std::concat_idents!`].
554+
///
555+
/// [`std::concat_idents!`]: ../std/macro.concat_idents.html
556+
#[unstable(feature = "concat_idents", issue = "29599")]
557+
#[macro_export]
558+
macro_rules! concat_idents {
559+
($($e:ident),*) => ({ /* compiler built-in */ })
560+
}
561+
562+
/// Concatenates literals into a static string slice.
563+
///
564+
/// For more information, see the documentation for [`std::concat!`].
565+
///
566+
/// [`std::concat!`]: ../std/macro.concat.html
567+
#[stable(feature = "rust1", since = "1.0.0")]
568+
#[macro_export]
569+
macro_rules! concat { ($($e:expr),*) => ({ /* compiler built-in */ }) }
570+
571+
/// A macro which expands to the line number on which it was invoked.
572+
///
573+
/// For more information, see the documentation for [`std::line!`].
574+
///
575+
/// [`std::line!`]: ../std/macro.line.html
576+
#[stable(feature = "rust1", since = "1.0.0")]
577+
#[macro_export]
578+
macro_rules! line { () => ({ /* compiler built-in */ }) }
579+
580+
/// A macro which expands to the column number on which it was invoked.
581+
///
582+
/// For more information, see the documentation for [`std::column!`].
583+
///
584+
/// [`std::column!`]: ../std/macro.column.html
585+
#[stable(feature = "rust1", since = "1.0.0")]
586+
#[macro_export]
587+
macro_rules! column { () => ({ /* compiler built-in */ }) }
588+
589+
/// A macro which expands to the file name from which it was invoked.
590+
///
591+
/// For more information, see the documentation for [`std::file!`].
592+
///
593+
/// [`std::file!`]: ../std/macro.file.html
594+
#[stable(feature = "rust1", since = "1.0.0")]
595+
#[macro_export]
596+
macro_rules! file { () => ({ /* compiler built-in */ }) }
597+
598+
/// A macro which stringifies its argument.
599+
///
600+
/// For more information, see the documentation for [`std::stringify!`].
601+
///
602+
/// [`std::stringify!`]: ../std/macro.stringify.html
603+
#[stable(feature = "rust1", since = "1.0.0")]
604+
#[macro_export]
605+
macro_rules! stringify { ($t:tt) => ({ /* compiler built-in */ }) }
606+
607+
/// Includes a utf8-encoded file as a string.
608+
///
609+
/// For more information, see the documentation for [`std::include_str!`].
610+
///
611+
/// [`std::include_str!`]: ../std/macro.include_str.html
612+
#[stable(feature = "rust1", since = "1.0.0")]
613+
#[macro_export]
614+
macro_rules! include_str { ($file:expr) => ({ /* compiler built-in */ }) }
615+
616+
/// Includes a file as a reference to a byte array.
617+
///
618+
/// For more information, see the documentation for [`std::include_bytes!`].
619+
///
620+
/// [`std::include_bytes!`]: ../std/macro.include_bytes.html
621+
#[stable(feature = "rust1", since = "1.0.0")]
622+
#[macro_export]
623+
macro_rules! include_bytes { ($file:expr) => ({ /* compiler built-in */ }) }
624+
625+
/// Expands to a string that represents the current module path.
626+
///
627+
/// For more information, see the documentation for [`std::module_path!`].
628+
///
629+
/// [`std::module_path!`]: ../std/macro.module_path.html
630+
#[stable(feature = "rust1", since = "1.0.0")]
631+
#[macro_export]
632+
macro_rules! module_path { () => ({ /* compiler built-in */ }) }
633+
634+
/// Boolean evaluation of configuration flags.
635+
///
636+
/// For more information, see the documentation for [`std::cfg!`].
637+
///
638+
/// [`std::cfg!`]: ../std/macro.cfg.html
639+
#[stable(feature = "rust1", since = "1.0.0")]
640+
#[macro_export]
641+
macro_rules! cfg { ($($cfg:tt)*) => ({ /* compiler built-in */ }) }
642+
643+
/// Parse the file provided in the argument as an expression or an
644+
/// item according to the context. This file is located relative
645+
/// to the current file (similarly to how modules are found).
646+
///
647+
/// For more information, see the documentation for [`std::include!`].
648+
///
649+
/// [`std::include!`]: ../std/macro.include.html
650+
#[stable(feature = "rust1", since = "1.0.0")]
651+
#[macro_export]
652+
macro_rules! include { ($file:expr) => ({ /* compiler built-in */ }) }
653+
}

0 commit comments

Comments
 (0)