]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #68098 - ssomers:btreemap_gdb_pretty_print, r=Mark-Simulacrum
authorbors <bors@rust-lang.org>
Sun, 22 Mar 2020 08:55:18 +0000 (08:55 +0000)
committerbors <bors@rust-lang.org>
Sun, 22 Mar 2020 08:55:18 +0000 (08:55 +0000)
Test gdb pretty printing more and fix overzealous type substitution

Adresses a problem concerning printing BTreeMap / BTreeSet data in gdb: when the key or value type name contains substring "LeafNode", and the map has multiple nodes (e.g. more than 11 elements), printing causes an exception. E.g.

```
rustc -g - <<EOF
    use std::collections::BTreeMap;

    struct MyLeafNode(i8);

    fn main() {
        let m: BTreeMap<i8, MyLeafNode> = (0..12).map(|i| (i, MyLeafNode(i))).collect();
        assert!(!m.is_empty());
    }
EOF
```

```
$ rust-gdb rust_out
(gdb) b 7
(gdb) r
(gdb) p m
$1 = BTreeMap<i8, rust_out::MyLeafNode>(len: 12)Python Exception <class 'gdb.error'> No type named alloc::collections::btree::node::InternalNode<i8, rust_out::MyInternalNode>.:
use std::collections::BTreeMap;
```

The code was written in #56144 by @tromey (and later touched upon by @RalfJung in #57045, but I think that had nothing to do with the issues in this PR).


Trivial merge