diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-20 11:52:31 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-07-26 13:09:54 +0300 |
| commit | 8eaf17bca2674293eba0ea10056d5c77b6352086 (patch) | |
| tree | a726739d50e26b0142be28425b154446f43e4fe5 /src/libcore | |
| parent | 4268e7ee22935f086b856ef0063a9e22b49aeddb (diff) | |
Introduce built-in macros through libcore
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/macros.rs | 14 | ||||
| -rw-r--r-- | src/libcore/prelude/v1.rs | 47 | ||||
| -rw-r--r-- | src/libcore/task/wake.rs | 2 |
3 files changed, 55 insertions, 8 deletions
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 17781798946..218c164a7dc 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -657,13 +657,13 @@ macro_rules! uninit_array { ); } -/// Built-in macros to the compiler itself. +/// Definitions of built-in macros. /// -/// These macros do not have any corresponding definition with a `macro_rules!` -/// macro, but are documented here. Their implementations can be found hardcoded -/// into libsyntax itself. -#[cfg(rustdoc)] -mod builtin { +/// Most of the macro properties (stability, visibility, etc.) are taken from the source code here, +/// with exception of expansion functions transforming macro inputs into outputs, +/// those functions are provided by the compiler. +#[cfg(not(bootstrap))] +pub(crate) mod builtin { /// Causes compilation to fail with the given error message when encountered. /// @@ -950,7 +950,7 @@ mod builtin { /// Same as `column`, but less likely to be shadowed. #[unstable(feature = "__rust_unstable_column", issue = "0", - reason = "internal implementation detail of the `column` macro")] + reason = "internal implementation detail of the `panic` macro")] #[rustc_builtin_macro] #[rustc_macro_transparency = "semitransparent"] pub macro __rust_unstable_column() { /* compiler built-in */ } diff --git a/src/libcore/prelude/v1.rs b/src/libcore/prelude/v1.rs index 501a41d0d1c..de79e2fa260 100644 --- a/src/libcore/prelude/v1.rs +++ b/src/libcore/prelude/v1.rs @@ -44,3 +44,50 @@ pub use crate::option::Option::{self, Some, None}; #[stable(feature = "core_prelude", since = "1.4.0")] #[doc(no_inline)] pub use crate::result::Result::{self, Ok, Err}; + +// Re-exported built-in macros +#[cfg(not(bootstrap))] +#[stable(feature = "builtin_macro_prelude", since = "1.38.0")] +#[allow(deprecated)] +#[doc(no_inline)] +pub use crate::macros::builtin::{ + Clone, + Copy, + Debug, + Decodable, + Default, + Encodable, + Eq, + Hash, + Ord, + PartialEq, + PartialOrd, + RustcDecodable, + RustcEncodable, + __rust_unstable_column, + asm, + assert, + bench, + cfg, + column, + compile_error, + concat, + concat_idents, + env, + file, + format_args, + format_args_nl, + global_allocator, + global_asm, + include, + include_bytes, + include_str, + line, + log_syntax, + module_path, + option_env, + stringify, + test, + test_case, + trace_macros, +}; diff --git a/src/libcore/task/wake.rs b/src/libcore/task/wake.rs index 6f841bd2adf..65e29364287 100644 --- a/src/libcore/task/wake.rs +++ b/src/libcore/task/wake.rs @@ -217,7 +217,7 @@ impl fmt::Debug for Context<'_> { /// This handle encapsulates a [`RawWaker`] instance, which defines the /// executor-specific wakeup behavior. /// -/// Implements [`Clone`], [`Send`], and [`Sync`]. +/// Implements [`Clone`], [`trait@Send`], and [`trait@Sync`]. /// /// [`RawWaker`]: struct.RawWaker.html #[repr(transparent)] |
