mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 19:53:46 +00:00
Rollup merge of #68200 - KodrAus:stabilize/debug_map_key_value, r=alexcrichton
Stabilize the debug_map_key_value feature RFC: https://github.com/rust-lang/rfcs/pull/2696 Tracking issue: #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.
This commit is contained in:
commit
5c42ffe150
@ -1,9 +0,0 @@
|
||||
# `debug_map_key_value`
|
||||
|
||||
The tracking issue for this feature is: [#62482]
|
||||
|
||||
[#62482]: https://github.com/rust-lang/rust/issues/62482
|
||||
|
||||
------------------------
|
||||
|
||||
Add the methods `key` and `value` to `DebugMap` so that an entry can be formatted across multiple calls without additional buffering.
|
@ -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)>);
|
||||
@ -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!(
|
||||
@ -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)>);
|
||||
@ -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");
|
||||
|
@ -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)]
|
||||
|
Loading…
Reference in New Issue
Block a user