]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-8898.rs
Auto merge of #104013 - notriddle:notriddle/rustdoc-sizeof, r=GuillaumeGomez
[rust.git] / src / test / ui / issues / issue-8898.rs
1 // run-pass
2
3 fn assert_repr_eq<T: std::fmt::Debug>(obj : T, expected : String) {
4     assert_eq!(expected, format!("{:?}", obj));
5 }
6
7 pub fn main() {
8     let abc = [1, 2, 3];
9     let tf = [true, false];
10     let x  = [(), ()];
11     let slice = &x[..1];
12
13     assert_repr_eq(&abc[..], "[1, 2, 3]".to_string());
14     assert_repr_eq(&tf[..], "[true, false]".to_string());
15     assert_repr_eq(&x[..], "[(), ()]".to_string());
16     assert_repr_eq(slice, "[()]".to_string());
17     assert_repr_eq(&x[..], "[(), ()]".to_string());
18 }