mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-05 20:34:52 +00:00
syntax: Use UFCS instead of secret_*
fns in expansion of format_args!
This commit is contained in:
parent
3327ecca42
commit
fc838ad0fd
@ -663,28 +663,28 @@ impl<'a, 'b> Context<'a, 'b> {
|
|||||||
fn format_arg(ecx: &ExtCtxt, sp: Span,
|
fn format_arg(ecx: &ExtCtxt, sp: Span,
|
||||||
ty: &ArgumentType, arg: P<ast::Expr>)
|
ty: &ArgumentType, arg: P<ast::Expr>)
|
||||||
-> P<ast::Expr> {
|
-> P<ast::Expr> {
|
||||||
let (krate, fmt_fn) = match *ty {
|
let trait_ = match *ty {
|
||||||
Known(ref tyname) => {
|
Known(ref tyname) => {
|
||||||
match tyname.as_slice() {
|
match tyname.as_slice() {
|
||||||
"" => ("std", "secret_show"),
|
"" => "Show",
|
||||||
"b" => ("std", "secret_bool"),
|
"b" => "Bool",
|
||||||
"c" => ("std", "secret_char"),
|
"c" => "Char",
|
||||||
"d" | "i" => ("std", "secret_signed"),
|
"d" | "i" => "Signed",
|
||||||
"e" => ("std", "secret_lower_exp"),
|
"e" => "LowerExp",
|
||||||
"E" => ("std", "secret_upper_exp"),
|
"E" => "UpperExp",
|
||||||
"f" => ("std", "secret_float"),
|
"f" => "Float",
|
||||||
"o" => ("std", "secret_octal"),
|
"o" => "Octal",
|
||||||
"p" => ("std", "secret_pointer"),
|
"p" => "Pointer",
|
||||||
"s" => ("std", "secret_string"),
|
"s" => "String",
|
||||||
"t" => ("std", "secret_binary"),
|
"t" => "Binary",
|
||||||
"u" => ("std", "secret_unsigned"),
|
"u" => "Unsigned",
|
||||||
"x" => ("std", "secret_lower_hex"),
|
"x" => "LowerHex",
|
||||||
"X" => ("std", "secret_upper_hex"),
|
"X" => "UpperHex",
|
||||||
_ => {
|
_ => {
|
||||||
ecx.span_err(sp,
|
ecx.span_err(sp,
|
||||||
format!("unknown format trait `{}`",
|
format!("unknown format trait `{}`",
|
||||||
*tyname).as_slice());
|
*tyname).as_slice());
|
||||||
("std", "dummy")
|
"Dummy"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -697,9 +697,10 @@ impl<'a, 'b> Context<'a, 'b> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let format_fn = ecx.path_global(sp, vec![
|
let format_fn = ecx.path_global(sp, vec![
|
||||||
ecx.ident_of(krate),
|
ecx.ident_of("std"),
|
||||||
ecx.ident_of("fmt"),
|
ecx.ident_of("fmt"),
|
||||||
ecx.ident_of(fmt_fn)]);
|
ecx.ident_of(trait_),
|
||||||
|
ecx.ident_of("fmt")]);
|
||||||
ecx.expr_call_global(sp, vec![
|
ecx.expr_call_global(sp, vec![
|
||||||
ecx.ident_of("std"),
|
ecx.ident_of("std"),
|
||||||
ecx.ident_of("fmt"),
|
ecx.ident_of("fmt"),
|
||||||
|
Loading…
Reference in New Issue
Block a user