Skip to content

Commit

Permalink
Rollup merge of rust-lang#68200 - KodrAus:stabilize/debug_map_key_val…
Browse files Browse the repository at this point in the history
…ue, r=alexcrichton

Stabilize the debug_map_key_value feature

RFC: rust-lang/rfcs#2696
Tracking issue: rust-lang#62482

Stabilizes the `debug_map_key_value` feature, which covers:

```rust
impl<'a, 'b> DebugMap<'a, 'b> {
    pub fn key(&mut self, key: &dyn fmt::Debug) -> &mut DebugMap<'a, 'b> {}
    pub fn value(&mut self, value: &dyn fmt::Debug) -> &mut DebugMap<'a, 'b> {}
}
```

These methods are small and self-contained, and are used as the basis for the existing `DebugMap::entry` method, so have been used in the wild for the last 6 months or so.
  • Loading branch information
JohnTitor committed Jan 28, 2020
2 parents 8a79d08 + 2c07a62 commit 5c42ffe
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.

This file was deleted.

6 changes: 2 additions & 4 deletions src/libcore/fmt/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,6 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
/// # Examples
///
/// ```
/// # #![feature(debug_map_key_value)]
/// use std::fmt;
///
/// struct Foo(Vec<(String, i32)>);
Expand All @@ -796,7 +795,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
/// "{\"whole\": [(\"A\", 10), (\"B\", 11)]}",
/// );
/// ```
#[unstable(feature = "debug_map_key_value", reason = "recently added", issue = "62482")]
#[stable(feature = "debug_map_key_value", since = "1.42.0")]
pub fn key(&mut self, key: &dyn fmt::Debug) -> &mut Self {
self.result = self.result.and_then(|_| {
assert!(
Expand Down Expand Up @@ -843,7 +842,6 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
/// # Examples
///
/// ```
/// # #![feature(debug_map_key_value)]
/// use std::fmt;
///
/// struct Foo(Vec<(String, i32)>);
Expand All @@ -861,7 +859,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
/// "{\"whole\": [(\"A\", 10), (\"B\", 11)]}",
/// );
/// ```
#[unstable(feature = "debug_map_key_value", reason = "recently added", issue = "62482")]
#[stable(feature = "debug_map_key_value", since = "1.42.0")]
pub fn value(&mut self, value: &dyn fmt::Debug) -> &mut Self {
self.result = self.result.and_then(|_| {
assert!(self.has_key, "attempted to format a map value before its key");
Expand Down
1 change: 0 additions & 1 deletion src/libcore/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#![feature(cell_update)]
#![feature(core_private_bignum)]
#![feature(core_private_diy_float)]
#![feature(debug_map_key_value)]
#![feature(debug_non_exhaustive)]
#![feature(dec2flt)]
#![feature(exact_size_is_empty)]
Expand Down

0 comments on commit 5c42ffe

Please sign in to comment.