From cbcc7dd182b9bf67d664508b82284c5539ef8819 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 28 Jul 2019 01:51:21 +0300 Subject: Give built-in macros stable addresses in the standard library --- src/libstd/lib.rs | 51 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-) (limited to 'src/libstd') 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, }; -- cgit 1.4.1-3-g733a5