Auto merge of #58714 - Centril:rollup, r=Centril
Rollup of 5 pull requests Successful merges: - #58370 (Relax some Hash bounds on HashMap<K, V, S> and HashSet<T, S>) - #58421 (Relax some Ord bounds on BinaryHeap<T>) - #58686 (replace deprecated rustfmt_skip with rustfmt::skip) - #58697 (Use ? in some macros) - #58704 (Remove some unnecessary 'extern crate') Failed merges: r? @ghost
This commit is contained in:
commit
c1911babed
@ -7,8 +7,6 @@
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
extern crate bootstrap;
|
||||
|
||||
use std::env;
|
||||
|
||||
use bootstrap::{Config, Build};
|
||||
|
@ -17,8 +17,6 @@
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
extern crate bootstrap;
|
||||
|
||||
use std::env;
|
||||
use std::ffi::OsString;
|
||||
use std::io;
|
||||
|
@ -4,8 +4,6 @@
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
extern crate bootstrap;
|
||||
|
||||
use std::env;
|
||||
use std::process::Command;
|
||||
use std::path::PathBuf;
|
||||
|
@ -1,5 +1,3 @@
|
||||
extern crate cc;
|
||||
|
||||
use std::env;
|
||||
use std::process::{self, Command};
|
||||
|
||||
|
@ -326,7 +326,7 @@ pub enum Kind {
|
||||
impl<'a> Builder<'a> {
|
||||
fn get_step_descriptions(kind: Kind) -> Vec<StepDescription> {
|
||||
macro_rules! describe {
|
||||
($($rule:ty),+ $(,)*) => {{
|
||||
($($rule:ty),+ $(,)?) => {{
|
||||
vec![$(StepDescription::from::<$rule>()),+]
|
||||
}};
|
||||
}
|
||||
|
@ -114,23 +114,11 @@ extern crate build_helper;
|
||||
extern crate serde_derive;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
extern crate serde_json;
|
||||
extern crate cmake;
|
||||
extern crate filetime;
|
||||
extern crate cc;
|
||||
extern crate getopts;
|
||||
extern crate num_cpus;
|
||||
extern crate toml;
|
||||
extern crate time;
|
||||
extern crate petgraph;
|
||||
|
||||
#[cfg(test)]
|
||||
#[macro_use]
|
||||
extern crate pretty_assertions;
|
||||
|
||||
#[cfg(unix)]
|
||||
extern crate libc;
|
||||
|
||||
use std::cell::{RefCell, Cell};
|
||||
use std::collections::{HashSet, HashMap};
|
||||
use std::env;
|
||||
|
@ -1,8 +1,6 @@
|
||||
#![feature(repr_simd)]
|
||||
#![feature(test)]
|
||||
|
||||
extern crate rand;
|
||||
extern crate rand_xorshift;
|
||||
extern crate test;
|
||||
|
||||
mod btree;
|
||||
|
@ -326,7 +326,7 @@ impl<T: Clone> Clone for Box<T> {
|
||||
/// let x = Box::new(5);
|
||||
/// let y = x.clone();
|
||||
/// ```
|
||||
#[rustfmt_skip]
|
||||
#[rustfmt::skip]
|
||||
#[inline]
|
||||
fn clone(&self) -> Box<T> {
|
||||
box { (**self).clone() }
|
||||
|
@ -294,7 +294,7 @@ impl<T: Ord> Default for BinaryHeap<T> {
|
||||
}
|
||||
|
||||
#[stable(feature = "binaryheap_debug", since = "1.4.0")]
|
||||
impl<T: fmt::Debug + Ord> fmt::Debug for BinaryHeap<T> {
|
||||
impl<T: fmt::Debug> fmt::Debug for BinaryHeap<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_list().entries(self.iter()).finish()
|
||||
}
|
||||
@ -336,6 +336,258 @@ impl<T: Ord> BinaryHeap<T> {
|
||||
BinaryHeap { data: Vec::with_capacity(capacity) }
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the greatest item in the binary heap, or
|
||||
/// `None` if it is empty.
|
||||
///
|
||||
/// Note: If the `PeekMut` value is leaked, the heap may be in an
|
||||
/// inconsistent state.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::BinaryHeap;
|
||||
/// let mut heap = BinaryHeap::new();
|
||||
/// assert!(heap.peek_mut().is_none());
|
||||
///
|
||||
/// heap.push(1);
|
||||
/// heap.push(5);
|
||||
/// heap.push(2);
|
||||
/// {
|
||||
/// let mut val = heap.peek_mut().unwrap();
|
||||
/// *val = 0;
|
||||
/// }
|
||||
/// assert_eq!(heap.peek(), Some(&2));
|
||||
/// ```
|
||||
#[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
|
||||
pub fn peek_mut(&mut self) -> Option<PeekMut<'_, T>> {
|
||||
if self.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(PeekMut {
|
||||
heap: self,
|
||||
sift: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// Removes the greatest item from the binary heap and returns it, or `None` if it
|
||||
/// is empty.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::BinaryHeap;
|
||||
/// let mut heap = BinaryHeap::from(vec![1, 3]);
|
||||
///
|
||||
/// assert_eq!(heap.pop(), Some(3));
|
||||
/// assert_eq!(heap.pop(), Some(1));
|
||||
/// assert_eq!(heap.pop(), None);
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn pop(&mut self) -> Option<T> {
|
||||
self.data.pop().map(|mut item| {
|
||||
if !self.is_empty() {
|
||||
swap(&mut item, &mut self.data[0]);
|
||||
self.sift_down_to_bottom(0);
|
||||
}
|
||||
item
|
||||
})
|
||||
}
|
||||
|
||||
/// Pushes an item onto the binary heap.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::BinaryHeap;
|
||||
/// let mut heap = BinaryHeap::new();
|
||||
/// heap.push(3);
|
||||
/// heap.push(5);
|
||||
/// heap.push(1);
|
||||
///
|
||||
/// assert_eq!(heap.len(), 3);
|
||||
/// assert_eq!(heap.peek(), Some(&5));
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn push(&mut self, item: T) {
|
||||
let old_len = self.len();
|
||||
self.data.push(item);
|
||||
self.sift_up(0, old_len);
|
||||
}
|
||||
|
||||
/// Consumes the `BinaryHeap` and returns a vector in sorted
|
||||
/// (ascending) order.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::BinaryHeap;
|
||||
///
|
||||
/// let mut heap = BinaryHeap::from(vec![1, 2, 4, 5, 7]);
|
||||
/// heap.push(6);
|
||||
/// heap.push(3);
|
||||
///
|
||||
/// let vec = heap.into_sorted_vec();
|
||||
/// assert_eq!(vec, [1, 2, 3, 4, 5, 6, 7]);
|
||||
/// ```
|
||||
#[stable(feature = "binary_heap_extras_15", since = "1.5.0")]
|
||||
pub fn into_sorted_vec(mut self) -> Vec<T> {
|
||||
let mut end = self.len();
|
||||
while end > 1 {
|
||||
end -= 1;
|
||||
self.data.swap(0, end);
|
||||
self.sift_down_range(0, end);
|
||||
}
|
||||
self.into_vec()
|
||||
}
|
||||
|
||||
// The implementations of sift_up and sift_down use unsafe blocks in
|
||||
// order to move an element out of the vector (leaving behind a
|
||||
// hole), shift along the others and move the removed element back into the
|
||||
// vector at the final location of the hole.
|
||||
// The `Hole` type is used to represent this, and make sure
|
||||
// the hole is filled back at the end of its scope, even on panic.
|
||||
// Using a hole reduces the constant factor compared to using swaps,
|
||||
// which involves twice as many moves.
|
||||
fn sift_up(&mut self, start: usize, pos: usize) -> usize {
|
||||
unsafe {
|
||||
// Take out the value at `pos` and create a hole.
|
||||
let mut hole = Hole::new(&mut self.data, pos);
|
||||
|
||||
while hole.pos() > start {
|
||||
let parent = (hole.pos() - 1) / 2;
|
||||
if hole.element() <= hole.get(parent) {
|
||||
break;
|
||||
}
|
||||
hole.move_to(parent);
|
||||
}
|
||||
hole.pos()
|
||||
}
|
||||
}
|
||||
|
||||
/// Take an element at `pos` and move it down the heap,
|
||||
/// while its children are larger.
|
||||
fn sift_down_range(&mut self, pos: usize, end: usize) {
|
||||
unsafe {
|
||||
let mut hole = Hole::new(&mut self.data, pos);
|
||||
let mut child = 2 * pos + 1;
|
||||
while child < end {
|
||||
let right = child + 1;
|
||||
// compare with the greater of the two children
|
||||
if right < end && !(hole.get(child) > hole.get(right)) {
|
||||
child = right;
|
||||
}
|
||||
// if we are already in order, stop.
|
||||
if hole.element() >= hole.get(child) {
|
||||
break;
|
||||
}
|
||||
hole.move_to(child);
|
||||
child = 2 * hole.pos() + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn sift_down(&mut self, pos: usize) {
|
||||
let len = self.len();
|
||||
self.sift_down_range(pos, len);
|
||||
}
|
||||
|
||||
/// Take an element at `pos` and move it all the way down the heap,
|
||||
/// then sift it up to its position.
|
||||
///
|
||||
/// Note: This is faster when the element is known to be large / should
|
||||
/// be closer to the bottom.
|
||||
fn sift_down_to_bottom(&mut self, mut pos: usize) {
|
||||
let end = self.len();
|
||||
let start = pos;
|
||||
unsafe {
|
||||
let mut hole = Hole::new(&mut self.data, pos);
|
||||
let mut child = 2 * pos + 1;
|
||||
while child < end {
|
||||
let right = child + 1;
|
||||
// compare with the greater of the two children
|
||||
if right < end && !(hole.get(child) > hole.get(right)) {
|
||||
child = right;
|
||||
}
|
||||
hole.move_to(child);
|
||||
child = 2 * hole.pos() + 1;
|
||||
}
|
||||
pos = hole.pos;
|
||||
}
|
||||
self.sift_up(start, pos);
|
||||
}
|
||||
|
||||
fn rebuild(&mut self) {
|
||||
let mut n = self.len() / 2;
|
||||
while n > 0 {
|
||||
n -= 1;
|
||||
self.sift_down(n);
|
||||
}
|
||||
}
|
||||
|
||||
/// Moves all the elements of `other` into `self`, leaving `other` empty.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::BinaryHeap;
|
||||
///
|
||||
/// let v = vec![-10, 1, 2, 3, 3];
|
||||
/// let mut a = BinaryHeap::from(v);
|
||||
///
|
||||
/// let v = vec![-20, 5, 43];
|
||||
/// let mut b = BinaryHeap::from(v);
|
||||
///
|
||||
/// a.append(&mut b);
|
||||
///
|
||||
/// assert_eq!(a.into_sorted_vec(), [-20, -10, 1, 2, 3, 3, 5, 43]);
|
||||
/// assert!(b.is_empty());
|
||||
/// ```
|
||||
#[stable(feature = "binary_heap_append", since = "1.11.0")]
|
||||
pub fn append(&mut self, other: &mut Self) {
|
||||
if self.len() < other.len() {
|
||||
swap(self, other);
|
||||
}
|
||||
|
||||
if other.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn log2_fast(x: usize) -> usize {
|
||||
8 * size_of::<usize>() - (x.leading_zeros() as usize) - 1
|
||||
}
|
||||
|
||||
// `rebuild` takes O(len1 + len2) operations
|
||||
// and about 2 * (len1 + len2) comparisons in the worst case
|
||||
// while `extend` takes O(len2 * log_2(len1)) operations
|
||||
// and about 1 * len2 * log_2(len1) comparisons in the worst case,
|
||||
// assuming len1 >= len2.
|
||||
#[inline]
|
||||
fn better_to_rebuild(len1: usize, len2: usize) -> bool {
|
||||
2 * (len1 + len2) < len2 * log2_fast(len1)
|
||||
}
|
||||
|
||||
if better_to_rebuild(self.len(), other.len()) {
|
||||
self.data.append(&mut other.data);
|
||||
self.rebuild();
|
||||
} else {
|
||||
self.extend(other.drain());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> BinaryHeap<T> {
|
||||
/// Returns an iterator visiting all values in the underlying vector, in
|
||||
/// arbitrary order.
|
||||
///
|
||||
@ -379,42 +631,6 @@ impl<T: Ord> BinaryHeap<T> {
|
||||
self.data.get(0)
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the greatest item in the binary heap, or
|
||||
/// `None` if it is empty.
|
||||
///
|
||||
/// Note: If the `PeekMut` value is leaked, the heap may be in an
|
||||
/// inconsistent state.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::BinaryHeap;
|
||||
/// let mut heap = BinaryHeap::new();
|
||||
/// assert!(heap.peek_mut().is_none());
|
||||
///
|
||||
/// heap.push(1);
|
||||
/// heap.push(5);
|
||||
/// heap.push(2);
|
||||
/// {
|
||||
/// let mut val = heap.peek_mut().unwrap();
|
||||
/// *val = 0;
|
||||
/// }
|
||||
/// assert_eq!(heap.peek(), Some(&2));
|
||||
/// ```
|
||||
#[stable(feature = "binary_heap_peek_mut", since = "1.12.0")]
|
||||
pub fn peek_mut(&mut self) -> Option<PeekMut<'_, T>> {
|
||||
if self.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(PeekMut {
|
||||
heap: self,
|
||||
sift: true,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the number of elements the binary heap can hold without reallocating.
|
||||
///
|
||||
/// # Examples
|
||||
@ -528,55 +744,6 @@ impl<T: Ord> BinaryHeap<T> {
|
||||
self.data.shrink_to(min_capacity)
|
||||
}
|
||||
|
||||
/// Removes the greatest item from the binary heap and returns it, or `None` if it
|
||||
/// is empty.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::BinaryHeap;
|
||||
/// let mut heap = BinaryHeap::from(vec![1, 3]);
|
||||
///
|
||||
/// assert_eq!(heap.pop(), Some(3));
|
||||
/// assert_eq!(heap.pop(), Some(1));
|
||||
/// assert_eq!(heap.pop(), None);
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn pop(&mut self) -> Option<T> {
|
||||
self.data.pop().map(|mut item| {
|
||||
if !self.is_empty() {
|
||||
swap(&mut item, &mut self.data[0]);
|
||||
self.sift_down_to_bottom(0);
|
||||
}
|
||||
item
|
||||
})
|
||||
}
|
||||
|
||||
/// Pushes an item onto the binary heap.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::BinaryHeap;
|
||||
/// let mut heap = BinaryHeap::new();
|
||||
/// heap.push(3);
|
||||
/// heap.push(5);
|
||||
/// heap.push(1);
|
||||
///
|
||||
/// assert_eq!(heap.len(), 3);
|
||||
/// assert_eq!(heap.peek(), Some(&5));
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn push(&mut self, item: T) {
|
||||
let old_len = self.len();
|
||||
self.data.push(item);
|
||||
self.sift_up(0, old_len);
|
||||
}
|
||||
|
||||
/// Consumes the `BinaryHeap` and returns the underlying vector
|
||||
/// in arbitrary order.
|
||||
///
|
||||
@ -599,110 +766,6 @@ impl<T: Ord> BinaryHeap<T> {
|
||||
self.into()
|
||||
}
|
||||
|
||||
/// Consumes the `BinaryHeap` and returns a vector in sorted
|
||||
/// (ascending) order.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::BinaryHeap;
|
||||
///
|
||||
/// let mut heap = BinaryHeap::from(vec![1, 2, 4, 5, 7]);
|
||||
/// heap.push(6);
|
||||
/// heap.push(3);
|
||||
///
|
||||
/// let vec = heap.into_sorted_vec();
|
||||
/// assert_eq!(vec, [1, 2, 3, 4, 5, 6, 7]);
|
||||
/// ```
|
||||
#[stable(feature = "binary_heap_extras_15", since = "1.5.0")]
|
||||
pub fn into_sorted_vec(mut self) -> Vec<T> {
|
||||
let mut end = self.len();
|
||||
while end > 1 {
|
||||
end -= 1;
|
||||
self.data.swap(0, end);
|
||||
self.sift_down_range(0, end);
|
||||
}
|
||||
self.into_vec()
|
||||
}
|
||||
|
||||
// The implementations of sift_up and sift_down use unsafe blocks in
|
||||
// order to move an element out of the vector (leaving behind a
|
||||
// hole), shift along the others and move the removed element back into the
|
||||
// vector at the final location of the hole.
|
||||
// The `Hole` type is used to represent this, and make sure
|
||||
// the hole is filled back at the end of its scope, even on panic.
|
||||
// Using a hole reduces the constant factor compared to using swaps,
|
||||
// which involves twice as many moves.
|
||||
fn sift_up(&mut self, start: usize, pos: usize) -> usize {
|
||||
unsafe {
|
||||
// Take out the value at `pos` and create a hole.
|
||||
let mut hole = Hole::new(&mut self.data, pos);
|
||||
|
||||
while hole.pos() > start {
|
||||
let parent = (hole.pos() - 1) / 2;
|
||||
if hole.element() <= hole.get(parent) {
|
||||
break;
|
||||
}
|
||||
hole.move_to(parent);
|
||||
}
|
||||
hole.pos()
|
||||
}
|
||||
}
|
||||
|
||||
/// Take an element at `pos` and move it down the heap,
|
||||
/// while its children are larger.
|
||||
fn sift_down_range(&mut self, pos: usize, end: usize) {
|
||||
unsafe {
|
||||
let mut hole = Hole::new(&mut self.data, pos);
|
||||
let mut child = 2 * pos + 1;
|
||||
while child < end {
|
||||
let right = child + 1;
|
||||
// compare with the greater of the two children
|
||||
if right < end && !(hole.get(child) > hole.get(right)) {
|
||||
child = right;
|
||||
}
|
||||
// if we are already in order, stop.
|
||||
if hole.element() >= hole.get(child) {
|
||||
break;
|
||||
}
|
||||
hole.move_to(child);
|
||||
child = 2 * hole.pos() + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn sift_down(&mut self, pos: usize) {
|
||||
let len = self.len();
|
||||
self.sift_down_range(pos, len);
|
||||
}
|
||||
|
||||
/// Take an element at `pos` and move it all the way down the heap,
|
||||
/// then sift it up to its position.
|
||||
///
|
||||
/// Note: This is faster when the element is known to be large / should
|
||||
/// be closer to the bottom.
|
||||
fn sift_down_to_bottom(&mut self, mut pos: usize) {
|
||||
let end = self.len();
|
||||
let start = pos;
|
||||
unsafe {
|
||||
let mut hole = Hole::new(&mut self.data, pos);
|
||||
let mut child = 2 * pos + 1;
|
||||
while child < end {
|
||||
let right = child + 1;
|
||||
// compare with the greater of the two children
|
||||
if right < end && !(hole.get(child) > hole.get(right)) {
|
||||
child = right;
|
||||
}
|
||||
hole.move_to(child);
|
||||
child = 2 * hole.pos() + 1;
|
||||
}
|
||||
pos = hole.pos;
|
||||
}
|
||||
self.sift_up(start, pos);
|
||||
}
|
||||
|
||||
/// Returns the length of the binary heap.
|
||||
///
|
||||
/// # Examples
|
||||
@ -789,67 +852,6 @@ impl<T: Ord> BinaryHeap<T> {
|
||||
pub fn clear(&mut self) {
|
||||
self.drain();
|
||||
}
|
||||
|
||||
fn rebuild(&mut self) {
|
||||
let mut n = self.len() / 2;
|
||||
while n > 0 {
|
||||
n -= 1;
|
||||
self.sift_down(n);
|
||||
}
|
||||
}
|
||||
|
||||
/// Moves all the elements of `other` into `self`, leaving `other` empty.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Basic usage:
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::BinaryHeap;
|
||||
///
|
||||
/// let v = vec![-10, 1, 2, 3, 3];
|
||||
/// let mut a = BinaryHeap::from(v);
|
||||
///
|
||||
/// let v = vec![-20, 5, 43];
|
||||
/// let mut b = BinaryHeap::from(v);
|
||||
///
|
||||
/// a.append(&mut b);
|
||||
///
|
||||
/// assert_eq!(a.into_sorted_vec(), [-20, -10, 1, 2, 3, 3, 5, 43]);
|
||||
/// assert!(b.is_empty());
|
||||
/// ```
|
||||
#[stable(feature = "binary_heap_append", since = "1.11.0")]
|
||||
pub fn append(&mut self, other: &mut Self) {
|
||||
if self.len() < other.len() {
|
||||
swap(self, other);
|
||||
}
|
||||
|
||||
if other.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn log2_fast(x: usize) -> usize {
|
||||
8 * size_of::<usize>() - (x.leading_zeros() as usize) - 1
|
||||
}
|
||||
|
||||
// `rebuild` takes O(len1 + len2) operations
|
||||
// and about 2 * (len1 + len2) comparisons in the worst case
|
||||
// while `extend` takes O(len2 * log_2(len1)) operations
|
||||
// and about 1 * len2 * log_2(len1) comparisons in the worst case,
|
||||
// assuming len1 >= len2.
|
||||
#[inline]
|
||||
fn better_to_rebuild(len1: usize, len2: usize) -> bool {
|
||||
2 * (len1 + len2) < len2 * log2_fast(len1)
|
||||
}
|
||||
|
||||
if better_to_rebuild(self.len(), other.len()) {
|
||||
self.data.append(&mut other.data);
|
||||
self.rebuild();
|
||||
} else {
|
||||
self.extend(other.drain());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Hole represents a hole in a slice i.e., an index without valid value
|
||||
@ -1111,7 +1113,7 @@ impl<T: Ord> FromIterator<T> for BinaryHeap<T> {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T: Ord> IntoIterator for BinaryHeap<T> {
|
||||
impl<T> IntoIterator for BinaryHeap<T> {
|
||||
type Item = T;
|
||||
type IntoIter = IntoIter<T>;
|
||||
|
||||
@ -1139,9 +1141,7 @@ impl<T: Ord> IntoIterator for BinaryHeap<T> {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> IntoIterator for &'a BinaryHeap<T>
|
||||
where T: Ord
|
||||
{
|
||||
impl<'a, T> IntoIterator for &'a BinaryHeap<T> {
|
||||
type Item = &'a T;
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
|
@ -8,9 +8,6 @@
|
||||
#![feature(unboxed_closures)]
|
||||
#![feature(vecdeque_rotate)]
|
||||
|
||||
extern crate core;
|
||||
extern crate rand;
|
||||
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::collections::hash_map::DefaultHasher;
|
||||
|
||||
|
@ -222,8 +222,8 @@ impl fmt::Debug for Span {
|
||||
|
||||
macro_rules! define_client_side {
|
||||
($($name:ident {
|
||||
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)*
|
||||
}),* $(,)*) => {
|
||||
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)?) $(-> $ret_ty:ty)*;)*
|
||||
}),* $(,)?) => {
|
||||
$(impl $name {
|
||||
$(pub(crate) fn $method($($arg: $arg_ty),*) $(-> $ret_ty)* {
|
||||
Bridge::with(|bridge| {
|
||||
|
@ -225,8 +225,8 @@ mod api_tags {
|
||||
|
||||
macro_rules! declare_tags {
|
||||
($($name:ident {
|
||||
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)*
|
||||
}),* $(,)*) => {
|
||||
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)?) $(-> $ret_ty:ty)*;)*
|
||||
}),* $(,)?) => {
|
||||
$(
|
||||
pub(super) enum $name {
|
||||
$($method),*
|
||||
@ -307,7 +307,7 @@ impl<T: Unmark> Unmark for Option<T> {
|
||||
}
|
||||
|
||||
macro_rules! mark_noop {
|
||||
($($ty:ty),* $(,)*) => {
|
||||
($($ty:ty),* $(,)?) => {
|
||||
$(
|
||||
impl Mark for $ty {
|
||||
type Unmarked = Self;
|
||||
|
@ -53,7 +53,7 @@ macro_rules! rpc_encode_decode {
|
||||
}
|
||||
}
|
||||
};
|
||||
(struct $name:ident { $($field:ident),* $(,)* }) => {
|
||||
(struct $name:ident { $($field:ident),* $(,)? }) => {
|
||||
impl<S> Encode<S> for $name {
|
||||
fn encode(self, w: &mut Writer, s: &mut S) {
|
||||
$(self.$field.encode(w, s);)*
|
||||
@ -68,8 +68,8 @@ macro_rules! rpc_encode_decode {
|
||||
}
|
||||
}
|
||||
};
|
||||
(enum $name:ident $(<$($T:ident),+>)* { $($variant:ident $(($field:ident))*),* $(,)* }) => {
|
||||
impl<S, $($($T: Encode<S>),+)*> Encode<S> for $name $(<$($T),+>)* {
|
||||
(enum $name:ident $(<$($T:ident),+>)? { $($variant:ident $(($field:ident))*),* $(,)? }) => {
|
||||
impl<S, $($($T: Encode<S>),+)?> Encode<S> for $name $(<$($T),+>)* {
|
||||
fn encode(self, w: &mut Writer, s: &mut S) {
|
||||
// HACK(eddyb): `Tag` enum duplicated between the
|
||||
// two impls as there's no other place to stash it.
|
||||
|
@ -39,14 +39,14 @@ macro_rules! associated_item {
|
||||
|
||||
macro_rules! declare_server_traits {
|
||||
($($name:ident {
|
||||
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)*
|
||||
}),* $(,)*) => {
|
||||
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)?) $(-> $ret_ty:ty)?;)*
|
||||
}),* $(,)?) => {
|
||||
pub trait Types {
|
||||
$(associated_item!(type $name);)*
|
||||
}
|
||||
|
||||
$(pub trait $name: Types {
|
||||
$(associated_item!(fn $method(&mut self, $($arg: $arg_ty),*) $(-> $ret_ty)*);)*
|
||||
$(associated_item!(fn $method(&mut self, $($arg: $arg_ty),*) $(-> $ret_ty)?);)*
|
||||
})*
|
||||
|
||||
pub trait Server: Types $(+ $name)* {}
|
||||
@ -59,14 +59,14 @@ pub(super) struct MarkedTypes<S: Types>(S);
|
||||
|
||||
macro_rules! define_mark_types_impls {
|
||||
($($name:ident {
|
||||
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)*
|
||||
}),* $(,)*) => {
|
||||
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)?) $(-> $ret_ty:ty)?;)*
|
||||
}),* $(,)?) => {
|
||||
impl<S: Types> Types for MarkedTypes<S> {
|
||||
$(type $name = Marked<S::$name, client::$name>;)*
|
||||
}
|
||||
|
||||
$(impl<S: $name> $name for MarkedTypes<S> {
|
||||
$(fn $method(&mut self, $($arg: $arg_ty),*) $(-> $ret_ty)* {
|
||||
$(fn $method(&mut self, $($arg: $arg_ty),*) $(-> $ret_ty)? {
|
||||
<_>::mark($name::$method(&mut self.0, $($arg.unmark()),*))
|
||||
})*
|
||||
})*
|
||||
@ -81,8 +81,8 @@ struct Dispatcher<S: Types> {
|
||||
|
||||
macro_rules! define_dispatcher_impl {
|
||||
($($name:ident {
|
||||
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)*) $(-> $ret_ty:ty)*;)*
|
||||
}),* $(,)*) => {
|
||||
$(fn $method:ident($($arg:ident: $arg_ty:ty),* $(,)?) $(-> $ret_ty:ty)?;)*
|
||||
}),* $(,)?) => {
|
||||
// FIXME(eddyb) `pub` only for `ExecutionStrategy` below.
|
||||
pub trait DispatcherTrait {
|
||||
// HACK(eddyb) these are here to allow `Self::$name` to work below.
|
||||
|
@ -111,7 +111,7 @@ macro_rules! define_dep_nodes {
|
||||
(<$tcx:tt>
|
||||
$(
|
||||
[$($attr:ident),* ]
|
||||
$variant:ident $(( $tuple_arg_ty:ty $(,)* ))*
|
||||
$variant:ident $(( $tuple_arg_ty:ty $(,)? ))*
|
||||
$({ $($struct_arg_name:ident : $struct_arg_ty:ty),* })*
|
||||
,)*
|
||||
) => (
|
||||
|
@ -257,7 +257,7 @@ macro_rules! CloneTypeFoldableAndLiftImpls {
|
||||
macro_rules! BraceStructLiftImpl {
|
||||
(impl<$($p:tt),*> Lift<$tcx:tt> for $s:path {
|
||||
type Lifted = $lifted:ty;
|
||||
$($field:ident),* $(,)*
|
||||
$($field:ident),* $(,)?
|
||||
} $(where $($wc:tt)*)*) => {
|
||||
impl<$($p),*> $crate::ty::Lift<$tcx> for $s
|
||||
$(where $($wc)*)*
|
||||
@ -327,7 +327,7 @@ macro_rules! EnumLiftImpl {
|
||||
#[macro_export]
|
||||
macro_rules! BraceStructTypeFoldableImpl {
|
||||
(impl<$($p:tt),*> TypeFoldable<$tcx:tt> for $s:path {
|
||||
$($field:ident),* $(,)*
|
||||
$($field:ident),* $(,)?
|
||||
} $(where $($wc:tt)*)*) => {
|
||||
impl<$($p),*> $crate::ty::fold::TypeFoldable<$tcx> for $s
|
||||
$(where $($wc)*)*
|
||||
@ -354,7 +354,7 @@ macro_rules! BraceStructTypeFoldableImpl {
|
||||
#[macro_export]
|
||||
macro_rules! TupleStructTypeFoldableImpl {
|
||||
(impl<$($p:tt),*> TypeFoldable<$tcx:tt> for $s:path {
|
||||
$($field:ident),* $(,)*
|
||||
$($field:ident),* $(,)?
|
||||
} $(where $($wc:tt)*)*) => {
|
||||
impl<$($p),*> $crate::ty::fold::TypeFoldable<$tcx> for $s
|
||||
$(where $($wc)*)*
|
||||
@ -426,7 +426,7 @@ macro_rules! EnumTypeFoldableImpl {
|
||||
};
|
||||
|
||||
(@FoldVariants($this:expr, $folder:expr)
|
||||
input( ($variant:path) { $($variant_arg:ident),* $(,)* } , $($input:tt)*)
|
||||
input( ($variant:path) { $($variant_arg:ident),* $(,)? } , $($input:tt)*)
|
||||
output( $($output:tt)*) ) => {
|
||||
EnumTypeFoldableImpl!(
|
||||
@FoldVariants($this, $folder)
|
||||
@ -480,7 +480,7 @@ macro_rules! EnumTypeFoldableImpl {
|
||||
};
|
||||
|
||||
(@VisitVariants($this:expr, $visitor:expr)
|
||||
input( ($variant:path) { $($variant_arg:ident),* $(,)* } , $($input:tt)*)
|
||||
input( ($variant:path) { $($variant_arg:ident),* $(,)? } , $($input:tt)*)
|
||||
output( $($output:tt)*) ) => {
|
||||
EnumTypeFoldableImpl!(
|
||||
@VisitVariants($this, $visitor)
|
||||
|
@ -36,7 +36,7 @@ macro_rules! forward {
|
||||
// Forward pattern for &self -> &Self
|
||||
(
|
||||
$(#[$attrs:meta])*
|
||||
pub fn $n:ident(&self, $($name:ident: $ty:ty),* $(,)*) -> &Self
|
||||
pub fn $n:ident(&self, $($name:ident: $ty:ty),* $(,)?) -> &Self
|
||||
) => {
|
||||
$(#[$attrs])*
|
||||
pub fn $n(&self, $($name: $ty),*) -> &Self {
|
||||
@ -48,7 +48,7 @@ macro_rules! forward {
|
||||
// Forward pattern for &mut self -> &mut Self
|
||||
(
|
||||
$(#[$attrs:meta])*
|
||||
pub fn $n:ident(&mut self, $($name:ident: $ty:ty),* $(,)*) -> &mut Self
|
||||
pub fn $n:ident(&mut self, $($name:ident: $ty:ty),* $(,)?) -> &mut Self
|
||||
) => {
|
||||
$(#[$attrs])*
|
||||
pub fn $n(&mut self, $($name: $ty),*) -> &mut Self {
|
||||
@ -64,7 +64,7 @@ macro_rules! forward {
|
||||
pub fn $n:ident<S: Into<MultiSpan>>(
|
||||
&mut self,
|
||||
$($name:ident: $ty:ty),*
|
||||
$(,)*
|
||||
$(,)?
|
||||
) -> &mut Self
|
||||
) => {
|
||||
$(#[$attrs])*
|
||||
|
@ -431,7 +431,7 @@ mod test {
|
||||
}
|
||||
|
||||
macro_rules! dummy_meta_item_list {
|
||||
($name:ident, [$($list:ident),* $(,)*]) => {
|
||||
($name:ident, [$($list:ident),* $(,)?]) => {
|
||||
MetaItem {
|
||||
ident: Path::from_ident(Ident::from_str(stringify!($name))),
|
||||
node: MetaItemKind::List(vec![
|
||||
@ -445,7 +445,7 @@ mod test {
|
||||
}
|
||||
};
|
||||
|
||||
($name:ident, [$($list:expr),* $(,)*]) => {
|
||||
($name:ident, [$($list:expr),* $(,)?]) => {
|
||||
MetaItem {
|
||||
ident: Path::from_ident(Ident::from_str(stringify!($name))),
|
||||
node: MetaItemKind::List(vec![
|
||||
|
@ -716,6 +716,232 @@ impl<K: Hash + Eq, V> HashMap<K, V, RandomState> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, V, S> HashMap<K, V, S> {
|
||||
/// Returns the number of elements the map can hold without reallocating.
|
||||
///
|
||||
/// This number is a lower bound; the `HashMap<K, V>` might be able to hold
|
||||
/// more, but is guaranteed to be able to hold at least this many.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
/// let map: HashMap<i32, i32> = HashMap::with_capacity(100);
|
||||
/// assert!(map.capacity() >= 100);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn capacity(&self) -> usize {
|
||||
self.resize_policy.capacity(self.raw_capacity())
|
||||
}
|
||||
|
||||
/// Returns the hash map's raw capacity.
|
||||
#[inline]
|
||||
fn raw_capacity(&self) -> usize {
|
||||
self.table.capacity()
|
||||
}
|
||||
|
||||
/// An iterator visiting all keys in arbitrary order.
|
||||
/// The iterator element type is `&'a K`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut map = HashMap::new();
|
||||
/// map.insert("a", 1);
|
||||
/// map.insert("b", 2);
|
||||
/// map.insert("c", 3);
|
||||
///
|
||||
/// for key in map.keys() {
|
||||
/// println!("{}", key);
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn keys(&self) -> Keys<K, V> {
|
||||
Keys { inner: self.iter() }
|
||||
}
|
||||
|
||||
/// An iterator visiting all values in arbitrary order.
|
||||
/// The iterator element type is `&'a V`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut map = HashMap::new();
|
||||
/// map.insert("a", 1);
|
||||
/// map.insert("b", 2);
|
||||
/// map.insert("c", 3);
|
||||
///
|
||||
/// for val in map.values() {
|
||||
/// println!("{}", val);
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn values(&self) -> Values<K, V> {
|
||||
Values { inner: self.iter() }
|
||||
}
|
||||
|
||||
/// An iterator visiting all values mutably in arbitrary order.
|
||||
/// The iterator element type is `&'a mut V`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut map = HashMap::new();
|
||||
///
|
||||
/// map.insert("a", 1);
|
||||
/// map.insert("b", 2);
|
||||
/// map.insert("c", 3);
|
||||
///
|
||||
/// for val in map.values_mut() {
|
||||
/// *val = *val + 10;
|
||||
/// }
|
||||
///
|
||||
/// for val in map.values() {
|
||||
/// println!("{}", val);
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "map_values_mut", since = "1.10.0")]
|
||||
pub fn values_mut(&mut self) -> ValuesMut<K, V> {
|
||||
ValuesMut { inner: self.iter_mut() }
|
||||
}
|
||||
|
||||
/// An iterator visiting all key-value pairs in arbitrary order.
|
||||
/// The iterator element type is `(&'a K, &'a V)`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut map = HashMap::new();
|
||||
/// map.insert("a", 1);
|
||||
/// map.insert("b", 2);
|
||||
/// map.insert("c", 3);
|
||||
///
|
||||
/// for (key, val) in map.iter() {
|
||||
/// println!("key: {} val: {}", key, val);
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn iter(&self) -> Iter<K, V> {
|
||||
Iter { inner: self.table.iter() }
|
||||
}
|
||||
|
||||
/// An iterator visiting all key-value pairs in arbitrary order,
|
||||
/// with mutable references to the values.
|
||||
/// The iterator element type is `(&'a K, &'a mut V)`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut map = HashMap::new();
|
||||
/// map.insert("a", 1);
|
||||
/// map.insert("b", 2);
|
||||
/// map.insert("c", 3);
|
||||
///
|
||||
/// // Update all values
|
||||
/// for (_, val) in map.iter_mut() {
|
||||
/// *val *= 2;
|
||||
/// }
|
||||
///
|
||||
/// for (key, val) in &map {
|
||||
/// println!("key: {} val: {}", key, val);
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn iter_mut(&mut self) -> IterMut<K, V> {
|
||||
IterMut { inner: self.table.iter_mut() }
|
||||
}
|
||||
|
||||
/// Returns the number of elements in the map.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut a = HashMap::new();
|
||||
/// assert_eq!(a.len(), 0);
|
||||
/// a.insert(1, "a");
|
||||
/// assert_eq!(a.len(), 1);
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn len(&self) -> usize {
|
||||
self.table.size()
|
||||
}
|
||||
|
||||
/// Returns `true` if the map contains no elements.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut a = HashMap::new();
|
||||
/// assert!(a.is_empty());
|
||||
/// a.insert(1, "a");
|
||||
/// assert!(!a.is_empty());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.len() == 0
|
||||
}
|
||||
|
||||
/// Clears the map, returning all key-value pairs as an iterator. Keeps the
|
||||
/// allocated memory for reuse.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut a = HashMap::new();
|
||||
/// a.insert(1, "a");
|
||||
/// a.insert(2, "b");
|
||||
///
|
||||
/// for (k, v) in a.drain().take(1) {
|
||||
/// assert!(k == 1 || k == 2);
|
||||
/// assert!(v == "a" || v == "b");
|
||||
/// }
|
||||
///
|
||||
/// assert!(a.is_empty());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "drain", since = "1.6.0")]
|
||||
pub fn drain(&mut self) -> Drain<K, V> {
|
||||
Drain { inner: self.table.drain() }
|
||||
}
|
||||
|
||||
/// Clears the map, removing all key-value pairs. Keeps the allocated memory
|
||||
/// for reuse.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut a = HashMap::new();
|
||||
/// a.insert(1, "a");
|
||||
/// a.clear();
|
||||
/// assert!(a.is_empty());
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn clear(&mut self) {
|
||||
self.drain();
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, V, S> HashMap<K, V, S>
|
||||
where K: Eq + Hash,
|
||||
S: BuildHasher
|
||||
@ -802,30 +1028,6 @@ impl<K, V, S> HashMap<K, V, S>
|
||||
&self.hash_builder
|
||||
}
|
||||
|
||||
/// Returns the number of elements the map can hold without reallocating.
|
||||
///
|
||||
/// This number is a lower bound; the `HashMap<K, V>` might be able to hold
|
||||
/// more, but is guaranteed to be able to hold at least this many.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
/// let map: HashMap<i32, i32> = HashMap::with_capacity(100);
|
||||
/// assert!(map.capacity() >= 100);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn capacity(&self) -> usize {
|
||||
self.resize_policy.capacity(self.raw_capacity())
|
||||
}
|
||||
|
||||
/// Returns the hash map's raw capacity.
|
||||
#[inline]
|
||||
fn raw_capacity(&self) -> usize {
|
||||
self.table.capacity()
|
||||
}
|
||||
|
||||
/// Reserves capacity for at least `additional` more elements to be inserted
|
||||
/// in the `HashMap`. The collection may reserve more space to avoid
|
||||
/// frequent reallocations.
|
||||
@ -1048,127 +1250,6 @@ impl<K, V, S> HashMap<K, V, S>
|
||||
}
|
||||
}
|
||||
|
||||
/// An iterator visiting all keys in arbitrary order.
|
||||
/// The iterator element type is `&'a K`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut map = HashMap::new();
|
||||
/// map.insert("a", 1);
|
||||
/// map.insert("b", 2);
|
||||
/// map.insert("c", 3);
|
||||
///
|
||||
/// for key in map.keys() {
|
||||
/// println!("{}", key);
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn keys(&self) -> Keys<K, V> {
|
||||
Keys { inner: self.iter() }
|
||||
}
|
||||
|
||||
/// An iterator visiting all values in arbitrary order.
|
||||
/// The iterator element type is `&'a V`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut map = HashMap::new();
|
||||
/// map.insert("a", 1);
|
||||
/// map.insert("b", 2);
|
||||
/// map.insert("c", 3);
|
||||
///
|
||||
/// for val in map.values() {
|
||||
/// println!("{}", val);
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn values(&self) -> Values<K, V> {
|
||||
Values { inner: self.iter() }
|
||||
}
|
||||
|
||||
/// An iterator visiting all values mutably in arbitrary order.
|
||||
/// The iterator element type is `&'a mut V`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut map = HashMap::new();
|
||||
///
|
||||
/// map.insert("a", 1);
|
||||
/// map.insert("b", 2);
|
||||
/// map.insert("c", 3);
|
||||
///
|
||||
/// for val in map.values_mut() {
|
||||
/// *val = *val + 10;
|
||||
/// }
|
||||
///
|
||||
/// for val in map.values() {
|
||||
/// println!("{}", val);
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "map_values_mut", since = "1.10.0")]
|
||||
pub fn values_mut(&mut self) -> ValuesMut<K, V> {
|
||||
ValuesMut { inner: self.iter_mut() }
|
||||
}
|
||||
|
||||
/// An iterator visiting all key-value pairs in arbitrary order.
|
||||
/// The iterator element type is `(&'a K, &'a V)`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut map = HashMap::new();
|
||||
/// map.insert("a", 1);
|
||||
/// map.insert("b", 2);
|
||||
/// map.insert("c", 3);
|
||||
///
|
||||
/// for (key, val) in map.iter() {
|
||||
/// println!("key: {} val: {}", key, val);
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn iter(&self) -> Iter<K, V> {
|
||||
Iter { inner: self.table.iter() }
|
||||
}
|
||||
|
||||
/// An iterator visiting all key-value pairs in arbitrary order,
|
||||
/// with mutable references to the values.
|
||||
/// The iterator element type is `(&'a K, &'a mut V)`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut map = HashMap::new();
|
||||
/// map.insert("a", 1);
|
||||
/// map.insert("b", 2);
|
||||
/// map.insert("c", 3);
|
||||
///
|
||||
/// // Update all values
|
||||
/// for (_, val) in map.iter_mut() {
|
||||
/// *val *= 2;
|
||||
/// }
|
||||
///
|
||||
/// for (key, val) in &map {
|
||||
/// println!("key: {} val: {}", key, val);
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn iter_mut(&mut self) -> IterMut<K, V> {
|
||||
IterMut { inner: self.table.iter_mut() }
|
||||
}
|
||||
|
||||
/// Gets the given key's corresponding entry in the map for in-place manipulation.
|
||||
///
|
||||
/// # Examples
|
||||
@ -1197,85 +1278,6 @@ impl<K, V, S> HashMap<K, V, S>
|
||||
.into_entry(key).expect("unreachable")
|
||||
}
|
||||
|
||||
/// Returns the number of elements in the map.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut a = HashMap::new();
|
||||
/// assert_eq!(a.len(), 0);
|
||||
/// a.insert(1, "a");
|
||||
/// assert_eq!(a.len(), 1);
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn len(&self) -> usize {
|
||||
self.table.size()
|
||||
}
|
||||
|
||||
/// Returns `true` if the map contains no elements.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut a = HashMap::new();
|
||||
/// assert!(a.is_empty());
|
||||
/// a.insert(1, "a");
|
||||
/// assert!(!a.is_empty());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.len() == 0
|
||||
}
|
||||
|
||||
/// Clears the map, returning all key-value pairs as an iterator. Keeps the
|
||||
/// allocated memory for reuse.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut a = HashMap::new();
|
||||
/// a.insert(1, "a");
|
||||
/// a.insert(2, "b");
|
||||
///
|
||||
/// for (k, v) in a.drain().take(1) {
|
||||
/// assert!(k == 1 || k == 2);
|
||||
/// assert!(v == "a" || v == "b");
|
||||
/// }
|
||||
///
|
||||
/// assert!(a.is_empty());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "drain", since = "1.6.0")]
|
||||
pub fn drain(&mut self) -> Drain<K, V> {
|
||||
Drain { inner: self.table.drain() }
|
||||
}
|
||||
|
||||
/// Clears the map, removing all key-value pairs. Keeps the allocated memory
|
||||
/// for reuse.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashMap;
|
||||
///
|
||||
/// let mut a = HashMap::new();
|
||||
/// a.insert(1, "a");
|
||||
/// a.clear();
|
||||
/// assert!(a.is_empty());
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn clear(&mut self) {
|
||||
self.drain();
|
||||
}
|
||||
|
||||
/// Returns a reference to the value corresponding to the key.
|
||||
///
|
||||
/// The key may be any borrowed form of the map's key type, but
|
||||
@ -2379,10 +2381,7 @@ enum VacantEntryState<K, V, M> {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, K, V, S> IntoIterator for &'a HashMap<K, V, S>
|
||||
where K: Eq + Hash,
|
||||
S: BuildHasher
|
||||
{
|
||||
impl<'a, K, V, S> IntoIterator for &'a HashMap<K, V, S> {
|
||||
type Item = (&'a K, &'a V);
|
||||
type IntoIter = Iter<'a, K, V>;
|
||||
|
||||
@ -2392,10 +2391,7 @@ impl<'a, K, V, S> IntoIterator for &'a HashMap<K, V, S>
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, K, V, S> IntoIterator for &'a mut HashMap<K, V, S>
|
||||
where K: Eq + Hash,
|
||||
S: BuildHasher
|
||||
{
|
||||
impl<'a, K, V, S> IntoIterator for &'a mut HashMap<K, V, S> {
|
||||
type Item = (&'a K, &'a mut V);
|
||||
type IntoIter = IterMut<'a, K, V>;
|
||||
|
||||
@ -2405,10 +2401,7 @@ impl<'a, K, V, S> IntoIterator for &'a mut HashMap<K, V, S>
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<K, V, S> IntoIterator for HashMap<K, V, S>
|
||||
where K: Eq + Hash,
|
||||
S: BuildHasher
|
||||
{
|
||||
impl<K, V, S> IntoIterator for HashMap<K, V, S> {
|
||||
type Item = (K, V);
|
||||
type IntoIter = IntoIter<K, V>;
|
||||
|
||||
|
@ -149,6 +149,118 @@ impl<T: Hash + Eq> HashSet<T, RandomState> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, S> HashSet<T, S> {
|
||||
/// Returns the number of elements the set can hold without reallocating.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashSet;
|
||||
/// let set: HashSet<i32> = HashSet::with_capacity(100);
|
||||
/// assert!(set.capacity() >= 100);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn capacity(&self) -> usize {
|
||||
self.map.capacity()
|
||||
}
|
||||
|
||||
/// An iterator visiting all elements in arbitrary order.
|
||||
/// The iterator element type is `&'a T`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashSet;
|
||||
/// let mut set = HashSet::new();
|
||||
/// set.insert("a");
|
||||
/// set.insert("b");
|
||||
///
|
||||
/// // Will print in an arbitrary order.
|
||||
/// for x in set.iter() {
|
||||
/// println!("{}", x);
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn iter(&self) -> Iter<T> {
|
||||
Iter { iter: self.map.keys() }
|
||||
}
|
||||
|
||||
/// Returns the number of elements in the set.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashSet;
|
||||
///
|
||||
/// let mut v = HashSet::new();
|
||||
/// assert_eq!(v.len(), 0);
|
||||
/// v.insert(1);
|
||||
/// assert_eq!(v.len(), 1);
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn len(&self) -> usize {
|
||||
self.map.len()
|
||||
}
|
||||
|
||||
/// Returns `true` if the set contains no elements.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashSet;
|
||||
///
|
||||
/// let mut v = HashSet::new();
|
||||
/// assert!(v.is_empty());
|
||||
/// v.insert(1);
|
||||
/// assert!(!v.is_empty());
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.map.is_empty()
|
||||
}
|
||||
|
||||
/// Clears the set, returning all elements in an iterator.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashSet;
|
||||
///
|
||||
/// let mut set: HashSet<_> = [1, 2, 3].iter().cloned().collect();
|
||||
/// assert!(!set.is_empty());
|
||||
///
|
||||
/// // print 1, 2, 3 in an arbitrary order
|
||||
/// for i in set.drain() {
|
||||
/// println!("{}", i);
|
||||
/// }
|
||||
///
|
||||
/// assert!(set.is_empty());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "drain", since = "1.6.0")]
|
||||
pub fn drain(&mut self) -> Drain<T> {
|
||||
Drain { iter: self.map.drain() }
|
||||
}
|
||||
|
||||
/// Clears the set, removing all values.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashSet;
|
||||
///
|
||||
/// let mut v = HashSet::new();
|
||||
/// v.insert(1);
|
||||
/// v.clear();
|
||||
/// assert!(v.is_empty());
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn clear(&mut self) {
|
||||
self.map.clear()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, S> HashSet<T, S>
|
||||
where T: Eq + Hash,
|
||||
S: BuildHasher
|
||||
@ -225,21 +337,6 @@ impl<T, S> HashSet<T, S>
|
||||
self.map.hasher()
|
||||
}
|
||||
|
||||
/// Returns the number of elements the set can hold without reallocating.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashSet;
|
||||
/// let set: HashSet<i32> = HashSet::with_capacity(100);
|
||||
/// assert!(set.capacity() >= 100);
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn capacity(&self) -> usize {
|
||||
self.map.capacity()
|
||||
}
|
||||
|
||||
/// Reserves capacity for at least `additional` more elements to be inserted
|
||||
/// in the `HashSet`. The collection may reserve more space to avoid
|
||||
/// frequent reallocations.
|
||||
@ -310,27 +407,6 @@ impl<T, S> HashSet<T, S>
|
||||
self.map.shrink_to(min_capacity)
|
||||
}
|
||||
|
||||
/// An iterator visiting all elements in arbitrary order.
|
||||
/// The iterator element type is `&'a T`.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashSet;
|
||||
/// let mut set = HashSet::new();
|
||||
/// set.insert("a");
|
||||
/// set.insert("b");
|
||||
///
|
||||
/// // Will print in an arbitrary order.
|
||||
/// for x in set.iter() {
|
||||
/// println!("{}", x);
|
||||
/// }
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn iter(&self) -> Iter<T> {
|
||||
Iter { iter: self.map.keys() }
|
||||
}
|
||||
|
||||
/// Visits the values representing the difference,
|
||||
/// i.e., the values that are in `self` but not in `other`.
|
||||
///
|
||||
@ -454,80 +530,6 @@ impl<T, S> HashSet<T, S>
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the number of elements in the set.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashSet;
|
||||
///
|
||||
/// let mut v = HashSet::new();
|
||||
/// assert_eq!(v.len(), 0);
|
||||
/// v.insert(1);
|
||||
/// assert_eq!(v.len(), 1);
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn len(&self) -> usize {
|
||||
self.map.len()
|
||||
}
|
||||
|
||||
/// Returns `true` if the set contains no elements.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashSet;
|
||||
///
|
||||
/// let mut v = HashSet::new();
|
||||
/// assert!(v.is_empty());
|
||||
/// v.insert(1);
|
||||
/// assert!(!v.is_empty());
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.map.is_empty()
|
||||
}
|
||||
|
||||
/// Clears the set, returning all elements in an iterator.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashSet;
|
||||
///
|
||||
/// let mut set: HashSet<_> = [1, 2, 3].iter().cloned().collect();
|
||||
/// assert!(!set.is_empty());
|
||||
///
|
||||
/// // print 1, 2, 3 in an arbitrary order
|
||||
/// for i in set.drain() {
|
||||
/// println!("{}", i);
|
||||
/// }
|
||||
///
|
||||
/// assert!(set.is_empty());
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "drain", since = "1.6.0")]
|
||||
pub fn drain(&mut self) -> Drain<T> {
|
||||
Drain { iter: self.map.drain() }
|
||||
}
|
||||
|
||||
/// Clears the set, removing all values.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use std::collections::HashSet;
|
||||
///
|
||||
/// let mut v = HashSet::new();
|
||||
/// v.insert(1);
|
||||
/// v.clear();
|
||||
/// assert!(v.is_empty());
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn clear(&mut self) {
|
||||
self.map.clear()
|
||||
}
|
||||
|
||||
/// Returns `true` if the set contains a value.
|
||||
///
|
||||
/// The value may be any borrowed form of the set's value type, but
|
||||
@ -1066,10 +1068,7 @@ pub struct Union<'a, T: 'a, S: 'a> {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T, S> IntoIterator for &'a HashSet<T, S>
|
||||
where T: Eq + Hash,
|
||||
S: BuildHasher
|
||||
{
|
||||
impl<'a, T, S> IntoIterator for &'a HashSet<T, S> {
|
||||
type Item = &'a T;
|
||||
type IntoIter = Iter<'a, T>;
|
||||
|
||||
@ -1079,10 +1078,7 @@ impl<'a, T, S> IntoIterator for &'a HashSet<T, S>
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<T, S> IntoIterator for HashSet<T, S>
|
||||
where T: Eq + Hash,
|
||||
S: BuildHasher
|
||||
{
|
||||
impl<T, S> IntoIterator for HashSet<T, S> {
|
||||
type Item = T;
|
||||
type IntoIter = IntoIter<T>;
|
||||
|
||||
|
@ -69,7 +69,7 @@ impl FromInternal<(TreeAndJoint, &'_ ParseSess, &'_ mut Vec<Self>)>
|
||||
};
|
||||
|
||||
macro_rules! tt {
|
||||
($ty:ident { $($field:ident $(: $value:expr)*),+ $(,)* }) => (
|
||||
($ty:ident { $($field:ident $(: $value:expr)*),+ $(,)? }) => (
|
||||
TokenTree::$ty(self::$ty {
|
||||
$($field $(: $value)*,)*
|
||||
span,
|
||||
|
@ -9,7 +9,7 @@ use super::super::TermInfo;
|
||||
|
||||
// These are the orders ncurses uses in its compiled format (as of 5.9). Not sure if portable.
|
||||
|
||||
#[rustfmt_skip]
|
||||
#[rustfmt::skip]
|
||||
pub static boolfnames: &[&str] = &["auto_left_margin", "auto_right_margin",
|
||||
"no_esc_ctlc", "ceol_standout_glitch", "eat_newline_glitch", "erase_overstrike", "generic_type",
|
||||
"hard_copy", "has_meta_key", "has_status_line", "insert_null_glitch", "memory_above",
|
||||
@ -22,13 +22,13 @@ pub static boolfnames: &[&str] = &["auto_left_margin", "auto_right_margin",
|
||||
"no_correctly_working_cr", "gnu_has_meta_key", "linefeed_is_newline", "has_hardware_tabs",
|
||||
"return_does_clr_eol"];
|
||||
|
||||
#[rustfmt_skip]
|
||||
#[rustfmt::skip]
|
||||
pub static boolnames: &[&str] = &["bw", "am", "xsb", "xhp", "xenl", "eo",
|
||||
"gn", "hc", "km", "hs", "in", "db", "da", "mir", "msgr", "os", "eslok", "xt", "hz", "ul", "xon",
|
||||
"nxon", "mc5i", "chts", "nrrmc", "npc", "ndscr", "ccc", "bce", "hls", "xhpa", "crxm", "daisy",
|
||||
"xvpa", "sam", "cpix", "lpix", "OTbs", "OTns", "OTnc", "OTMT", "OTNL", "OTpt", "OTxr"];
|
||||
|
||||
#[rustfmt_skip]
|
||||
#[rustfmt::skip]
|
||||
pub static numfnames: &[&str] = &[ "columns", "init_tabs", "lines",
|
||||
"lines_of_memory", "magic_cookie_glitch", "padding_baud_rate", "virtual_terminal",
|
||||
"width_status_line", "num_labels", "label_height", "label_width", "max_attributes",
|
||||
@ -39,13 +39,13 @@ pub static numfnames: &[&str] = &[ "columns", "init_tabs", "lines",
|
||||
"bit_image_entwining", "bit_image_type", "magic_cookie_glitch_ul", "carriage_return_delay",
|
||||
"new_line_delay", "backspace_delay", "horizontal_tab_delay", "number_of_function_keys"];
|
||||
|
||||
#[rustfmt_skip]
|
||||
#[rustfmt::skip]
|
||||
pub static numnames: &[&str] = &[ "cols", "it", "lines", "lm", "xmc", "pb",
|
||||
"vt", "wsl", "nlab", "lh", "lw", "ma", "wnum", "colors", "pairs", "ncv", "bufsz", "spinv",
|
||||
"spinh", "maddr", "mjump", "mcs", "mls", "npins", "orc", "orl", "orhi", "orvi", "cps", "widcs",
|
||||
"btns", "bitwin", "bitype", "UTug", "OTdC", "OTdN", "OTdB", "OTdT", "OTkn"];
|
||||
|
||||
#[rustfmt_skip]
|
||||
#[rustfmt::skip]
|
||||
pub static stringfnames: &[&str] = &[ "back_tab", "bell", "carriage_return",
|
||||
"change_scroll_region", "clear_all_tabs", "clear_screen", "clr_eol", "clr_eos",
|
||||
"column_address", "command_character", "cursor_address", "cursor_down", "cursor_home",
|
||||
@ -119,7 +119,7 @@ pub static stringfnames: &[&str] = &[ "back_tab", "bell", "carriage_return",
|
||||
"acs_lrcorner", "acs_ltee", "acs_rtee", "acs_btee", "acs_ttee", "acs_hline", "acs_vline",
|
||||
"acs_plus", "memory_lock", "memory_unlock", "box_chars_1"];
|
||||
|
||||
#[rustfmt_skip]
|
||||
#[rustfmt::skip]
|
||||
pub static stringnames: &[&str] = &[ "cbt", "_", "cr", "csr", "tbc", "clear",
|
||||
"_", "_", "hpa", "cmdch", "cup", "cud1", "home", "civis", "cub1", "mrcup", "cnorm", "cuf1",
|
||||
"ll", "cuu1", "cvvis", "dch1", "dl1", "dsl", "hd", "smacs", "blink", "bold", "smcup", "smdc",
|
||||
|
@ -1,6 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
fn intersect_map<K, V>(this: &mut HashMap<K, V>, other: HashMap<K, V>) -> bool {
|
||||
this.drain()
|
||||
use std::collections::HashSet;
|
||||
|
||||
fn is_subset<T>(this: &HashSet<T>, other: &HashSet<T>) -> bool {
|
||||
this.is_subset(other)
|
||||
//~^ ERROR no method named
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
error[E0599]: no method named `drain` found for type `&mut std::collections::HashMap<K, V>` in the current scope
|
||||
--> $DIR/issue-35677.rs:3:10
|
||||
error[E0599]: no method named `is_subset` found for type `&std::collections::HashSet<T>` in the current scope
|
||||
--> $DIR/issue-35677.rs:4:10
|
||||
|
|
||||
LL | this.drain()
|
||||
| ^^^^^
|
||||
LL | this.is_subset(other)
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
= note: the method `drain` exists but the following trait bounds were not satisfied:
|
||||
`K : std::cmp::Eq`
|
||||
`K : std::hash::Hash`
|
||||
= note: the method `is_subset` exists but the following trait bounds were not satisfied:
|
||||
`T : std::cmp::Eq`
|
||||
`T : std::hash::Hash`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user