From b53454e2e413ac58da20933968cb4a86a3c7c476 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 22 May 2014 11:28:01 -0700 Subject: Move std::{reflect,repr,Poly} to a libdebug crate This commit moves reflection (as well as the {:?} format modifier) to a new libdebug crate, all of which is marked experimental. This is a breaking change because it now requires the debug crate to be explicitly linked if the :? format qualifier is used. This means that any code using this feature will have to add `extern crate debug;` to the top of the crate. Any code relying on reflection will also need to do this. Closes #12019 [breaking-change] --- src/libsyntax/ext/format.rs | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/libsyntax/ext/format.rs') diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index 86652cd50b0..f21239af6af 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -773,30 +773,30 @@ impl<'a, 'b> Context<'a, 'b> { Named(ref s) => self.name_types.get(s) }; - let fmt_fn = match *ty { + let (krate, fmt_fn) = match *ty { Known(ref tyname) => { match tyname.as_slice() { - "" => "secret_show", - "?" => "secret_poly", - "b" => "secret_bool", - "c" => "secret_char", - "d" | "i" => "secret_signed", - "e" => "secret_lower_exp", - "E" => "secret_upper_exp", - "f" => "secret_float", - "o" => "secret_octal", - "p" => "secret_pointer", - "s" => "secret_string", - "t" => "secret_binary", - "u" => "secret_unsigned", - "x" => "secret_lower_hex", - "X" => "secret_upper_hex", + "" => ("std", "secret_show"), + "?" => ("debug", "secret_poly"), + "b" => ("std", "secret_bool"), + "c" => ("std", "secret_char"), + "d" | "i" => ("std", "secret_signed"), + "e" => ("std", "secret_lower_exp"), + "E" => ("std", "secret_upper_exp"), + "f" => ("std", "secret_float"), + "o" => ("std", "secret_octal"), + "p" => ("std", "secret_pointer"), + "s" => ("std", "secret_string"), + "t" => ("std", "secret_binary"), + "u" => ("std", "secret_unsigned"), + "x" => ("std", "secret_lower_hex"), + "X" => ("std", "secret_upper_hex"), _ => { self.ecx .span_err(sp, format!("unknown format trait `{}`", *tyname).as_slice()); - "dummy" + ("std", "dummy") } } } @@ -815,7 +815,7 @@ impl<'a, 'b> Context<'a, 'b> { }; let format_fn = self.ecx.path_global(sp, vec!( - self.ecx.ident_of("std"), + self.ecx.ident_of(krate), self.ecx.ident_of("fmt"), self.ecx.ident_of(fmt_fn))); self.ecx.expr_call_global(sp, vec!( -- cgit 1.4.1-3-g733a5