Skip to content

Commit d9d9246

Browse files
committed
Remove gensym from format_args
1 parent 7b41fd2 commit d9d9246

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

src/libcore/macros.rs

-2
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,6 @@ pub(crate) mod builtin {
767767
#[stable(feature = "rust1", since = "1.0.0")]
768768
#[allow_internal_unstable(fmt_internals)]
769769
#[rustc_builtin_macro]
770-
#[rustc_macro_transparency = "semitransparent"]
771770
pub macro format_args {
772771
($fmt:expr) => ({ /* compiler built-in */ }),
773772
($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ })
@@ -779,7 +778,6 @@ pub(crate) mod builtin {
779778
language use and is subject to change")]
780779
#[allow_internal_unstable(fmt_internals)]
781780
#[rustc_builtin_macro]
782-
#[rustc_macro_transparency = "semitransparent"]
783781
pub macro format_args_nl {
784782
($fmt:expr) => ({ /* compiler built-in */ }),
785783
($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ })

src/libsyntax_ext/format.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ impl<'a, 'b> Context<'a, 'b> {
646646
let mut heads = Vec::with_capacity(self.args.len());
647647

648648
let names_pos: Vec<_> = (0..self.args.len())
649-
.map(|i| self.ecx.ident_of(&format!("arg{}", i)).gensym())
649+
.map(|i| ast::Ident::from_str_and_span(&format!("arg{}", i), self.macsp))
650650
.collect();
651651

652652
// First, build up the static array which will become our precompiled
@@ -843,7 +843,7 @@ pub fn expand_preparsed_format_args(
843843
let arg_unique_types: Vec<_> = (0..args.len()).map(|_| Vec::new()).collect();
844844

845845
let mut macsp = ecx.call_site();
846-
macsp = macsp.apply_mark(ecx.current_expansion.id);
846+
macsp = macsp.with_ctxt(ecx.backtrace());
847847

848848
let msg = "format argument must be a string literal";
849849
let fmt_sp = efmt.span;

src/test/ui/format-hygiene.rs

-8
This file was deleted.

src/test/ui/hygiene/format-args.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// check-pass
2+
3+
#![allow(non_upper_case_globals)]
4+
#![feature(format_args_nl)]
5+
6+
static arg0: () = ();
7+
8+
fn main() {
9+
static arg1: () = ();
10+
format_args!("{} {:?}", 0, 1);
11+
format_args_nl!("{} {:?}", 0, 1);
12+
}

0 commit comments

Comments
 (0)