about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-08-16 18:22:30 +0200
committerGitHub <noreply@github.com>2019-08-16 18:22:30 +0200
commitcd21715c3412dc381e386db229cb679015289359 (patch)
treec0bba6bbb16621c3803202560d595aef2daa77ed /src/libstd
parentb7311316fe8b6638d5d9dc07f18def8f60f0b9d2 (diff)
parent263e3c59505a16e78b757e0ead3928a3e961a8ab (diff)
downloadrust-cd21715c3412dc381e386db229cb679015289359.tar.gz
rust-cd21715c3412dc381e386db229cb679015289359.zip
Rollup merge of #63613 - petrochenkov:stdhyg, r=alexcrichton
Hygienize use of built-in macros in the standard library

Same as https://github.com/rust-lang/rust/pull/61629, but for built-in macros.

Closes https://github.com/rust-lang/rust/issues/48781
r? @alexcrichton
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/lib.rs2
-rw-r--r--src/libstd/macros.rs20
-rw-r--r--src/libstd/prelude/v1.rs1
3 files changed, 10 insertions, 13 deletions
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 760d92f1d7b..c3882bacf87 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -228,7 +228,6 @@
 // std is implemented with unstable features, many of which are internal
 // compiler details that will never be stable
 // NB: the following list is sorted to minimize merge conflicts.
-#![feature(__rust_unstable_column)]
 #![feature(alloc_error_handler)]
 #![feature(alloc_layout_extra)]
 #![feature(allocator_api)]
@@ -551,7 +550,6 @@ pub use core::{
     option_env,
     stringify,
     // Unstable
-    __rust_unstable_column,
     asm,
     concat_idents,
     format_args_nl,
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index f2000936b9a..cbeaf20b13a 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -53,20 +53,20 @@
 /// ```
 #[macro_export]
 #[stable(feature = "rust1", since = "1.0.0")]
-#[allow_internal_unstable(__rust_unstable_column, libstd_sys_internals)]
+#[allow_internal_unstable(libstd_sys_internals)]
 macro_rules! panic {
     () => ({
         $crate::panic!("explicit panic")
     });
     ($msg:expr) => ({
-        $crate::rt::begin_panic($msg, &(file!(), line!(), __rust_unstable_column!()))
+        $crate::rt::begin_panic($msg, &($crate::file!(), $crate::line!(), $crate::column!()))
     });
     ($msg:expr,) => ({
         $crate::panic!($msg)
     });
     ($fmt:expr, $($arg:tt)+) => ({
-        $crate::rt::begin_panic_fmt(&format_args!($fmt, $($arg)+),
-                                    &(file!(), line!(), __rust_unstable_column!()))
+        $crate::rt::begin_panic_fmt(&$crate::format_args!($fmt, $($arg)+),
+                                    &($crate::file!(), $crate::line!(), $crate::column!()))
     });
 }
 
@@ -113,7 +113,7 @@ macro_rules! panic {
 #[stable(feature = "rust1", since = "1.0.0")]
 #[allow_internal_unstable(print_internals)]
 macro_rules! print {
-    ($($arg:tt)*) => ($crate::io::_print(format_args!($($arg)*)));
+    ($($arg:tt)*) => ($crate::io::_print($crate::format_args!($($arg)*)));
 }
 
 /// Prints to the standard output, with a newline.
@@ -147,7 +147,7 @@ macro_rules! print {
 macro_rules! println {
     () => ($crate::print!("\n"));
     ($($arg:tt)*) => ({
-        $crate::io::_print(format_args_nl!($($arg)*));
+        $crate::io::_print($crate::format_args_nl!($($arg)*));
     })
 }
 
@@ -176,7 +176,7 @@ macro_rules! println {
 #[stable(feature = "eprint", since = "1.19.0")]
 #[allow_internal_unstable(print_internals)]
 macro_rules! eprint {
-    ($($arg:tt)*) => ($crate::io::_eprint(format_args!($($arg)*)));
+    ($($arg:tt)*) => ($crate::io::_eprint($crate::format_args!($($arg)*)));
 }
 
 /// Prints to the standard error, with a newline.
@@ -206,7 +206,7 @@ macro_rules! eprint {
 macro_rules! eprintln {
     () => ($crate::eprint!("\n"));
     ($($arg:tt)*) => ({
-        $crate::io::_eprint(format_args_nl!($($arg)*));
+        $crate::io::_eprint($crate::format_args_nl!($($arg)*));
     })
 }
 
@@ -337,7 +337,7 @@ macro_rules! eprintln {
 #[stable(feature = "dbg_macro", since = "1.32.0")]
 macro_rules! dbg {
     () => {
-        $crate::eprintln!("[{}:{}]", file!(), line!());
+        $crate::eprintln!("[{}:{}]", $crate::file!(), $crate::line!());
     };
     ($val:expr) => {
         // Use of `match` here is intentional because it affects the lifetimes
@@ -345,7 +345,7 @@ macro_rules! dbg {
         match $val {
             tmp => {
                 $crate::eprintln!("[{}:{}] {} = {:#?}",
-                    file!(), line!(), stringify!($val), &tmp);
+                    $crate::file!(), $crate::line!(), $crate::stringify!($val), &tmp);
                 tmp
             }
         }
diff --git a/src/libstd/prelude/v1.rs b/src/libstd/prelude/v1.rs
index 752c6202ee4..3e4cf91127f 100644
--- a/src/libstd/prelude/v1.rs
+++ b/src/libstd/prelude/v1.rs
@@ -40,7 +40,6 @@ pub use crate::result::Result::{self, Ok, Err};
 #[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
 #[doc(no_inline)]
 pub use core::prelude::v1::{
-    __rust_unstable_column,
     asm,
     assert,
     cfg,