diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-07-28 01:51:21 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-08-10 00:05:37 +0300 |
| commit | cbcc7dd182b9bf67d664508b82284c5539ef8819 (patch) | |
| tree | 380086210f82747225b911eb6cc0598b767d0285 /src/libstd | |
| parent | 534b42394d743511db1335d5ed08d507ab7c6e73 (diff) | |
| download | rust-cbcc7dd182b9bf67d664508b82284c5539ef8819.tar.gz rust-cbcc7dd182b9bf67d664508b82284c5539ef8819.zip | |
Give built-in macros stable addresses in the standard library
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/lib.rs | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 54abf72d307..e03626fb7f5 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -326,16 +326,6 @@ use prelude::v1::*; // Access to Bencher, etc. #[cfg(test)] extern crate test; -// Re-export a few macros from core -#[stable(feature = "rust1", since = "1.0.0")] -pub use core::{assert_eq, assert_ne, debug_assert, debug_assert_eq, debug_assert_ne}; -#[stable(feature = "rust1", since = "1.0.0")] -pub use core::{unreachable, unimplemented, write, writeln, todo}; -// FIXME: change this to `#[allow(deprecated)]` when we update nightly compiler. -#[allow(deprecated_in_future)] -#[stable(feature = "rust1", since = "1.0.0")] -pub use core::r#try; - #[allow(unused_imports)] // macros from `alloc` are not used on all platforms #[macro_use] extern crate alloc as alloc_crate; @@ -520,33 +510,52 @@ mod std_detect; #[cfg(not(test))] pub use std_detect::detect; -// Document built-in macros in the crate root for consistency with libcore and existing tradition. -// FIXME: Attribute and derive macros are not reexported because rustdoc renders them -// as reexports rather than as macros, and that's not what we want. -#[cfg(rustdoc)] +// Re-export macros defined in libcore. +#[stable(feature = "rust1", since = "1.0.0")] +#[allow(deprecated_in_future)] +pub use core::{ + // Stable + assert_eq, + assert_ne, + debug_assert_eq, + debug_assert_ne, + debug_assert, + r#try, + unimplemented, + unreachable, + write, + writeln, + // Unstable + todo, +}; + +// Re-export built-in macros defined through libcore. +#[cfg(not(bootstrap))] #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] -pub use crate::prelude::v1::{ - __rust_unstable_column, - asm, +pub use core::{ + // Stable assert, cfg, column, compile_error, concat, - concat_idents, env, file, format_args, - format_args_nl, - global_asm, include, include_bytes, include_str, line, - log_syntax, module_path, option_env, stringify, + // Unstable + __rust_unstable_column, + asm, + concat_idents, + format_args_nl, + global_asm, + log_syntax, trace_macros, }; |
