TrieSet should impl Set/MutableSet; add with_capacity to PriorityQueue/SmallIntMap

Two minor tweaks to collections. This makes `TrieSet` implement `Set` and `MutableSet`. It also allows preinitialization of `PriorityQueue` and `SmallIntMap`.

This is a rebased version of #13061.