forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#53112 - fukatani:pretty-print-btreeset, r=m…
…ichaelwoerister pretty print BTreeSet I want pretty printing for BTreeSet. ```rust use std::collections::*; fn main() { let mut s = BTreeSet::new(); s.insert(5); s.insert(3); s.insert(7); s.remove(&3); println!("{:?}", s); } ``` ``` (gdb) b 9 (gdb) p s $1 = BTreeSet<i32> with 2 elements = {[0] = 5, [1] = 7} ``` This is analogy of pretty printing for C++ std::set.
- Loading branch information
Showing
3 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// ignore-windows failing on win32 bot | ||
// ignore-freebsd: gdb package too new | ||
// ignore-android: FIXME(#10381) | ||
// compile-flags:-g | ||
// min-gdb-version 7.7 | ||
// min-lldb-version: 310 | ||
|
||
// === GDB TESTS =================================================================================== | ||
|
||
// gdb-command: run | ||
|
||
// gdb-command: print btree_set | ||
// gdb-check:$1 = BTreeSet<i32>(len: 3) = {3, 5, 7} | ||
|
||
// gdb-command: print vec_deque | ||
// gdb-check:$2 = VecDeque<i32>(len: 3, cap: 8) = {5, 3, 7} | ||
|
||
#![allow(unused_variables)] | ||
use std::collections::BTreeSet; | ||
use std::collections::VecDeque; | ||
|
||
|
||
fn main() { | ||
|
||
// BTreeSet | ||
let mut btree_set = BTreeSet::new(); | ||
btree_set.insert(5); | ||
btree_set.insert(3); | ||
btree_set.insert(7); | ||
|
||
// VecDeque | ||
let mut vec_deque = VecDeque::new(); | ||
vec_deque.push_back(5); | ||
vec_deque.push_back(3); | ||
vec_deque.push_back(7); | ||
|
||
zzz(); // #break | ||
} | ||
|
||
fn zzz() { () } |