diff --git a/src/liballoc/macros.rs b/src/liballoc/macros.rs index 250c419c531f8..0b5e186d4c77b 100644 --- a/src/liballoc/macros.rs +++ b/src/liballoc/macros.rs @@ -98,5 +98,5 @@ macro_rules! vec { #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] macro_rules! format { - ($($arg:tt)*) => ($crate::fmt::format(format_args!($($arg)*))) + ($($arg:tt)*) => ($crate::fmt::format(::core::format_args!($($arg)*))) } diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index bbed95167161d..e114f3af0c515 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -2,21 +2,21 @@ /// /// For details, see `std::macros`. #[macro_export] -#[allow_internal_unstable(core_panic, __rust_unstable_column)] +#[allow_internal_unstable(core_panic)] #[stable(feature = "core", since = "1.6.0")] macro_rules! panic { () => ( $crate::panic!("explicit panic") ); ($msg:expr) => ({ - $crate::panicking::panic(&($msg, file!(), line!(), __rust_unstable_column!())) + $crate::panicking::panic(&($msg, $crate::file!(), $crate::line!(), $crate::column!())) }); ($msg:expr,) => ( $crate::panic!($msg) ); ($fmt:expr, $($arg:tt)+) => ({ - $crate::panicking::panic_fmt(format_args!($fmt, $($arg)+), - &(file!(), line!(), __rust_unstable_column!())) + $crate::panicking::panic_fmt($crate::format_args!($fmt, $($arg)+), + &($crate::file!(), $crate::line!(), $crate::column!())) }); } @@ -70,7 +70,7 @@ macro_rules! assert_eq { panic!(r#"assertion failed: `(left == right)` left: `{:?}`, right: `{:?}`: {}"#, &*left_val, &*right_val, - format_args!($($arg)+)) + $crate::format_args!($($arg)+)) } } } @@ -127,7 +127,7 @@ macro_rules! assert_ne { panic!(r#"assertion failed: `(left != right)` left: `{:?}`, right: `{:?}`: {}"#, &*left_val, &*right_val, - format_args!($($arg)+)) + $crate::format_args!($($arg)+)) } } } @@ -181,7 +181,7 @@ macro_rules! assert_ne { #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] macro_rules! debug_assert { - ($($arg:tt)*) => (if cfg!(debug_assertions) { assert!($($arg)*); }) + ($($arg:tt)*) => (if $crate::cfg!(debug_assertions) { $crate::assert!($($arg)*); }) } /// Asserts that two expressions are equal to each other. @@ -208,7 +208,7 @@ macro_rules! debug_assert { #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] macro_rules! debug_assert_eq { - ($($arg:tt)*) => (if cfg!(debug_assertions) { $crate::assert_eq!($($arg)*); }) + ($($arg:tt)*) => (if $crate::cfg!(debug_assertions) { $crate::assert_eq!($($arg)*); }) } /// Asserts that two expressions are not equal to each other. @@ -235,7 +235,7 @@ macro_rules! debug_assert_eq { #[macro_export] #[stable(feature = "assert_ne", since = "1.13.0")] macro_rules! debug_assert_ne { - ($($arg:tt)*) => (if cfg!(debug_assertions) { $crate::assert_ne!($($arg)*); }) + ($($arg:tt)*) => (if $crate::cfg!(debug_assertions) { $crate::assert_ne!($($arg)*); }) } /// Unwraps a result or propagates its error. @@ -386,7 +386,7 @@ macro_rules! r#try { #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] macro_rules! write { - ($dst:expr, $($arg:tt)*) => ($dst.write_fmt(format_args!($($arg)*))) + ($dst:expr, $($arg:tt)*) => ($dst.write_fmt($crate::format_args!($($arg)*))) } /// Write formatted data into a buffer, with a newline appended. @@ -446,7 +446,7 @@ macro_rules! writeln { $crate::writeln!($dst) ); ($dst:expr, $($arg:tt)*) => ( - $dst.write_fmt(format_args_nl!($($arg)*)) + $dst.write_fmt($crate::format_args_nl!($($arg)*)) ); } @@ -515,7 +515,7 @@ macro_rules! unreachable { $crate::unreachable!($msg) }); ($fmt:expr, $($arg:tt)*) => ({ - panic!(concat!("internal error: entered unreachable code: ", $fmt), $($arg)*) + panic!($crate::concat!("internal error: entered unreachable code: ", $fmt), $($arg)*) }); } @@ -573,7 +573,7 @@ macro_rules! unreachable { #[stable(feature = "rust1", since = "1.0.0")] macro_rules! unimplemented { () => (panic!("not yet implemented")); - ($($arg:tt)+) => (panic!("not yet implemented: {}", format_args!($($arg)+))); + ($($arg:tt)+) => (panic!("not yet implemented: {}", $crate::format_args!($($arg)+))); } /// Indicates unfinished code. @@ -632,7 +632,7 @@ macro_rules! unimplemented { #[unstable(feature = "todo_macro", issue = "59277")] macro_rules! todo { () => (panic!("not yet implemented")); - ($($arg:tt)+) => (panic!("not yet implemented: {}", format_args!($($arg)+))); + ($($arg:tt)+) => (panic!("not yet implemented: {}", $crate::format_args!($($arg)+))); } /// Definitions of built-in macros. @@ -927,13 +927,6 @@ pub(crate) mod builtin { #[macro_export] macro_rules! column { () => { /* compiler built-in */ } } - /// Same as `column`, but less likely to be shadowed. - #[unstable(feature = "__rust_unstable_column", issue = "0", - reason = "internal implementation detail of the `panic` macro")] - #[rustc_builtin_macro] - #[macro_export] - macro_rules! __rust_unstable_column { () => { /* compiler built-in */ } } - /// Expands to the file name in which it was invoked. /// /// With [`line!`] and [`column!`], these macros provide debugging information for diff --git a/src/libcore/prelude/v1.rs b/src/libcore/prelude/v1.rs index 762403790403d..7cc279a9ef2ec 100644 --- a/src/libcore/prelude/v1.rs +++ b/src/libcore/prelude/v1.rs @@ -56,7 +56,6 @@ pub use crate::hash::macros::Hash; #[stable(feature = "builtin_macro_prelude", since = "1.38.0")] #[doc(no_inline)] pub use crate::{ - __rust_unstable_column, asm, assert, cfg, diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 760d92f1d7b0e..c3882bacf87eb 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 f2000936b9a21..cbeaf20b13adc 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 752c6202ee489..3e4cf91127fc5 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, diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs index 3ded808bb358a..4add2261c6cda 100644 --- a/src/libsyntax_ext/lib.rs +++ b/src/libsyntax_ext/lib.rs @@ -57,7 +57,6 @@ pub fn register_builtin_macros(resolver: &mut dyn syntax::ext::base::Resolver, e } register_bang! { - __rust_unstable_column: source_util::expand_column, asm: asm::expand_asm, assert: assert::expand_assert, cfg: cfg::expand_cfg, diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index e2d1635f31216..27fc66d3b09e6 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -609,7 +609,6 @@ symbols! { rust_eh_personality, rust_eh_unwind_resume, rust_oom, - __rust_unstable_column, rvalue_static_promotion, sanitizer_runtime, _Self, diff --git a/src/test/ui/macros/trace-macro.stderr b/src/test/ui/macros/trace-macro.stderr index 287f7b297d5c6..202a9235adbac 100644 --- a/src/test/ui/macros/trace-macro.stderr +++ b/src/test/ui/macros/trace-macro.stderr @@ -5,5 +5,5 @@ LL | println!("Hello, World!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: expanding `println! { "Hello, World!" }` - = note: to `{ $crate :: io :: _print (format_args_nl ! ("Hello, World!")) ; }` + = note: to `{ $crate :: io :: _print ($crate :: format_args_nl ! ("Hello, World!")) ; }` diff --git a/src/test/ui/rust-unstable-column-gated.rs b/src/test/ui/rust-unstable-column-gated.rs deleted file mode 100644 index 053806ead2d12..0000000000000 --- a/src/test/ui/rust-unstable-column-gated.rs +++ /dev/null @@ -1,4 +0,0 @@ -fn main() { - println!("{}", __rust_unstable_column!()); - //~^ ERROR use of unstable library feature '__rust_unstable_column' -} diff --git a/src/test/ui/rust-unstable-column-gated.stderr b/src/test/ui/rust-unstable-column-gated.stderr deleted file mode 100644 index 7db1b01fb0e63..0000000000000 --- a/src/test/ui/rust-unstable-column-gated.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0658]: use of unstable library feature '__rust_unstable_column': internal implementation detail of the `panic` macro - --> $DIR/rust-unstable-column-gated.rs:2:20 - | -LL | println!("{}", __rust_unstable_column!()); - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(__rust_unstable_column)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`.