about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2019-08-05 23:10:32 +0100
committerMatthew Jasper <mjjasper1@gmail.com>2019-08-05 23:50:47 +0100
commitd9d9246418ae884cb67feb3574832696660b8e2e (patch)
tree7c1057d7534bd270c9c4460bed00d3043771312c /src
parent7b41fd215893c06110c7f650be47efed3910d90b (diff)
Remove gensym from format_args
Diffstat (limited to 'src')
-rw-r--r--src/libcore/macros.rs2
-rw-r--r--src/libsyntax_ext/format.rs4
-rw-r--r--src/test/ui/format-hygiene.rs8
-rw-r--r--src/test/ui/hygiene/format-args.rs12
4 files changed, 14 insertions, 12 deletions
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs
index 37cc71bff62..6a2c3bff4dd 100644
--- a/src/libcore/macros.rs
+++ b/src/libcore/macros.rs
@@ -767,7 +767,6 @@ pub(crate) mod builtin {
     #[stable(feature = "rust1", since = "1.0.0")]
     #[allow_internal_unstable(fmt_internals)]
     #[rustc_builtin_macro]
-    #[rustc_macro_transparency = "semitransparent"]
     pub macro format_args {
         ($fmt:expr) => ({ /* compiler built-in */ }),
         ($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ })
@@ -779,7 +778,6 @@ pub(crate) mod builtin {
                          language use and is subject to change")]
     #[allow_internal_unstable(fmt_internals)]
     #[rustc_builtin_macro]
-    #[rustc_macro_transparency = "semitransparent"]
     pub macro format_args_nl {
         ($fmt:expr) => ({ /* compiler built-in */ }),
         ($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ })
diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs
index fe9cad1e32f..1dfcc14021c 100644
--- a/src/libsyntax_ext/format.rs
+++ b/src/libsyntax_ext/format.rs
@@ -646,7 +646,7 @@ impl<'a, 'b> Context<'a, 'b> {
         let mut heads = Vec::with_capacity(self.args.len());
 
         let names_pos: Vec<_> = (0..self.args.len())
-            .map(|i| self.ecx.ident_of(&format!("arg{}", i)).gensym())
+            .map(|i| ast::Ident::from_str_and_span(&format!("arg{}", i), self.macsp))
             .collect();
 
         // First, build up the static array which will become our precompiled
@@ -843,7 +843,7 @@ pub fn expand_preparsed_format_args(
     let arg_unique_types: Vec<_> = (0..args.len()).map(|_| Vec::new()).collect();
 
     let mut macsp = ecx.call_site();
-    macsp = macsp.apply_mark(ecx.current_expansion.id);
+    macsp = macsp.with_ctxt(ecx.backtrace());
 
     let msg = "format argument must be a string literal";
     let fmt_sp = efmt.span;
diff --git a/src/test/ui/format-hygiene.rs b/src/test/ui/format-hygiene.rs
deleted file mode 100644
index 6bf5ae8bead..00000000000
--- a/src/test/ui/format-hygiene.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-// run-pass
-
-#![allow(non_upper_case_globals)]
-pub const arg0: u8 = 1;
-
-pub fn main() {
-    format!("{}", 1);
-}
diff --git a/src/test/ui/hygiene/format-args.rs b/src/test/ui/hygiene/format-args.rs
new file mode 100644
index 00000000000..d74889b95cc
--- /dev/null
+++ b/src/test/ui/hygiene/format-args.rs
@@ -0,0 +1,12 @@
+// check-pass
+
+#![allow(non_upper_case_globals)]
+#![feature(format_args_nl)]
+
+static arg0: () = ();
+
+fn main() {
+    static arg1: () = ();
+    format_args!("{} {:?}", 0, 1);
+    format_args_nl!("{} {:?}", 0, 1);
+}