rust/src/libcore/tests
bors 152217d29c Auto merge of #48978 - SimonSapin:debug-hex, r=KodrAus
Add hexadecimal formatting of integers with fmt::Debug

This can be used for integers within a larger types which implements Debug (possibly through derive) but not fmt::UpperHex or fmt::LowerHex.

```rust
assert!(format!("{:02x?}", b"Foo\0") == "[46, 6f, 6f, 00]");
assert!(format!("{:02X?}", b"Foo\0") == "[46, 6F, 6F, 00]");
```

RFC: https://github.com/rust-lang/rfcs/pull/2226

The new formatting string syntax (`x?` and `X?`) is insta-stable in this PR because I don’t know how to change a built-in proc macro’s behavior based of a feature gate. I can look into adding that, but I also strongly suspect that keeping this feature unstable for a time period would not be useful as possibly no-one would use it during that time.

This PR does not add the new (public) `fmt::Formatter` proposed in the API because:

* There was some skepticism on response to this part of the RFC
* It is not possible to implement as-is without larger changes to `fmt`, because `Formatter` at the moment has no easy way to tell apart for example `Octal` from `Binary`: it only has a function pointer for the relevant `fmt()` method.

If some integer-like type outside of `std` want to implement this behavior, another RFC will likely need to propose a different public API for `Formatter`.
2018-03-19 02:38:19 +00:00
..
fmt Add hexadecimal formatting of integers with fmt::Debug 2018-03-13 14:53:06 +01:00
hash Implement Hash for raw pointers to unsized types 2017-10-25 11:07:13 -07:00
num Update Cargo submodule 2018-03-11 10:59:28 -07:00
any.rs Move libXtest into libX/tests 2017-04-03 20:49:39 +02:00
array.rs Try to fix array TryFrom tests 2017-09-24 14:54:04 -04:00
ascii.rs include AsciiExt in tests 2018-03-12 01:04:51 -04:00
atomic.rs Add fetch_nand. 2018-02-09 16:04:41 -07:00
cell.rs Implement RefCell::replace and RefCell::swap 2017-07-31 21:19:09 +00:00
char.rs Remove test case that assumes FromStr provides TryFrom<&'a str>. 2017-08-30 04:43:09 -07:00
clone.rs Move libXtest into libX/tests 2017-04-03 20:49:39 +02:00
cmp.rs Add max and min default fns to Ord trait 2017-06-06 22:42:48 -04:00
intrinsics.rs Move libXtest into libX/tests 2017-04-03 20:49:39 +02:00
iter.rs Add a Zip::nth test for side effects 2018-03-01 02:17:50 -08:00
lib.rs Keep the fields of RangeInclusive unstable. 2018-03-15 17:01:30 +08:00
mem.rs core: Ensure std::mem::Discriminant is Send + Sync 2017-10-08 01:09:55 +02:00
nonzero.rs Rename {NonZero,Shared,Unique}::new to new_unchecked 2017-07-22 20:38:16 +02:00
ops.rs Fix tidy 2018-02-09 02:11:04 -08:00
option.rs Rename option::Missing to NoneError 2017-09-27 17:57:07 -04:00
pattern.rs Regression tests for #47175 2018-01-06 11:17:12 +05:30
ptr.rs Mark Unique as perma-unstable, with the feature renamed to ptr_internals. 2018-01-20 11:09:23 +01:00
result.rs Rename option::Missing to NoneError 2017-09-27 17:57:07 -04:00
slice.rs Update Cargo submodule 2018-03-11 10:59:28 -07:00
str.rs Move libXtest into libX/tests 2017-04-03 20:49:39 +02:00
tuple.rs Move libXtest into libX/tests 2017-04-03 20:49:39 +02:00