1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
12 #![feature(binary_heap_extras)]
14 use std::collections::BinaryHeap;
16 fn make_pq() -> BinaryHeap<isize> {
17 BinaryHeap::from(vec![1,2,3])
21 let mut pq = make_pq();
23 while let Some(x) = pq.pop() {
30 'a: while let Some(x) = pq.pop() {
40 'a: while let Some(x) = pq.pop() {
48 let mut pq1 = make_pq();
50 while let Some(x) = pq1.pop() {
51 let mut pq2 = make_pq();
52 while let Some(y) = pq2.pop() {
56 assert_eq!(sum, 6 + 12 + 18);