about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-09-11 02:38:03 +0200
committerGitHub <noreply@github.com>2019-09-11 02:38:03 +0200
commite757d33e73cd707ecf95a6cd27e3f75b4f8b702f (patch)
tree6c814f26439ed4bc5b0754700e869161235ad47b /src/liballoc
parent34e82a7b793a6cdd27df762bf46bab8cdc92b14a (diff)
parentd42e60331fb08efce78e7fc9739bf42620e51f8f (diff)
downloadrust-e757d33e73cd707ecf95a6cd27e3f75b4f8b702f.tar.gz
rust-e757d33e73cd707ecf95a6cd27e3f75b4f8b702f.zip
Rollup merge of #64060 - petrochenkov:unstdhyg, r=tmandry
Improve hygiene of `alloc::format!`

`format` now uses `format_args` though a `__export` module, as described in https://github.com/rust-lang/rust/issues/63687#issuecomment-526254208.

Fixes https://github.com/rust-lang/rust/issues/63687
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/lib.rs6
-rw-r--r--src/liballoc/macros.rs2
2 files changed, 7 insertions, 1 deletions
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs
index 4a48945adc3..370e5cf4b30 100644
--- a/src/liballoc/lib.rs
+++ b/src/liballoc/lib.rs
@@ -171,3 +171,9 @@ pub mod vec;
 mod std {
     pub use core::ops; // RangeFull
 }
+
+#[doc(hidden)]
+#[unstable(feature = "liballoc_internals", issue = "0", reason = "implementation detail")]
+pub mod __export {
+    pub use core::format_args;
+}
diff --git a/src/liballoc/macros.rs b/src/liballoc/macros.rs
index 0b5e186d4c7..2f2cdc39c63 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(::core::format_args!($($arg)*)))
+    ($($arg:tt)*) => ($crate::fmt::format($crate::__export::format_args!($($arg)*)))
 }