1
Fork 0

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]
This commit is contained in:
Alex Crichton 2014-05-22 11:28:01 -07:00
parent 911cc9c352
commit b53454e2e4
156 changed files with 1545 additions and 147 deletions

View file

@ -1906,7 +1906,7 @@ impl ::Decoder<DecoderError> for Decoder {
names: &[&str],
f: |&mut Decoder, uint| -> DecodeResult<T>)
-> DecodeResult<T> {
debug!("read_enum_variant(names={:?})", names);
debug!("read_enum_variant(names={})", names);
let name = match self.pop() {
String(s) => s,
Object(mut o) => {
@ -1961,7 +1961,7 @@ impl ::Decoder<DecoderError> for Decoder {
names: &[&str],
f: |&mut Decoder, uint| -> DecodeResult<T>)
-> DecodeResult<T> {
debug!("read_enum_struct_variant(names={:?})", names);
debug!("read_enum_struct_variant(names={})", names);
self.read_enum_variant(names, f)
}
@ -3013,7 +3013,7 @@ mod tests {
let bytes = mem_buf.unwrap();
let json_str = from_utf8(bytes.as_slice()).unwrap();
match from_str(json_str) {
Err(_) => fail!("Unable to parse json_str: {:?}", json_str),
Err(_) => fail!("Unable to parse json_str: {}", json_str),
_ => {} // it parsed and we are good to go
}
}
@ -3033,7 +3033,7 @@ mod tests {
let bytes = mem_buf.unwrap();
let json_str = from_utf8(bytes.as_slice()).unwrap();
match from_str(json_str) {
Err(_) => fail!("Unable to parse json_str: {:?}", json_str),
Err(_) => fail!("Unable to parse json_str: {}", json_str),
_ => {} // it parsed and we are good to go
}
}
@ -3043,7 +3043,7 @@ mod tests {
use Decodable;
let json_str = "{\"1\":true}";
let json_obj = match from_str(json_str) {
Err(_) => fail!("Unable to parse json_str: {:?}", json_str),
Err(_) => fail!("Unable to parse json_str: {}", json_str),
Ok(o) => o
};
let mut decoder = Decoder::new(json_obj);