diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-05-22 11:28:01 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-27 21:44:51 -0700 |
| commit | b53454e2e413ac58da20933968cb4a86a3c7c476 (patch) | |
| tree | 049f02aae3a1c7be395a3b7467ae31af92def081 /src/libsyntax | |
| parent | 911cc9c35234ab12a4b9a6fc1cb35b52556f242d (diff) | |
| download | rust-b53454e2e413ac58da20933968cb4a86a3c7c476.tar.gz rust-b53454e2e413ac58da20933968cb4a86a3c7c476.zip | |
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]
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/format.rs | 36 | ||||
| -rw-r--r-- | src/libsyntax/lib.rs | 1 |
2 files changed, 19 insertions, 18 deletions
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!( diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 52612bb4dec..627b2b71b35 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -36,6 +36,7 @@ extern crate collections; #[phase(syntax, link)] extern crate log; extern crate fmt_macros; +extern crate debug; pub mod util { pub mod interner; |
