rust/src/libcore/tests/fmt
bors 8cacf50563 Auto merge of #66716 - derekdreery:debug_non_exhaustive, r=dtolnay
Implement `DebugStruct::non_exhaustive`.

This patch adds a function (finish_non_exhaustive) to add ellipsis before the closing brace when formatting using `DebugStruct`.

 ## Example

 ```rust
 #![feature(debug_non_exhaustive)]
 use std::fmt;

 struct Bar {
     bar: i32,
     hidden: f32,
 }

 impl fmt::Debug for Bar {
     fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
         fmt.debug_struct("Bar")
            .field("bar", &self.bar)
            .non_exhaustive(true) // Show that some other field(s) exist.
            .finish()
     }
 }

 assert_eq!(
     format!("{:?}", Bar { bar: 10, hidden: 1.0 }),
     "Bar { bar: 10, .. }",
 );
 ```
2020-01-17 00:20:48 +00:00
..
builders.rs Rust ./x.py fmt 2020-01-16 20:11:16 +00:00
float.rs Remove licenses 2018-12-25 21:08:33 -07:00
mod.rs Reset Formatter flags on exit from pad_integral 2020-01-01 15:22:02 -05:00
num.rs Replace assert with assert_eq for better debugging 2019-03-12 10:08:57 +05:30