add a rustc::query_stability lint

This commit is contained in:
lcnr
2021-10-05 16:20:43 +02:00
parent 7f7915347d
commit 80fe0bb76e
11 changed files with 246 additions and 65 deletions

View File

@@ -414,6 +414,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// println!("key: {} val: {}", key, val);
/// }
/// ```
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<'_, K, V> {
Iter { base: self.base.iter() }
@@ -442,6 +443,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// println!("key: {} val: {}", key, val);
/// }
/// ```
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter_mut(&mut self) -> IterMut<'_, K, V> {
IterMut { base: self.base.iter_mut() }
@@ -502,6 +504,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// assert!(a.is_empty());
/// ```
#[inline]
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
#[stable(feature = "drain", since = "1.6.0")]
pub fn drain(&mut self) -> Drain<'_, K, V> {
Drain { base: self.base.drain() }
@@ -543,6 +546,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// assert_eq!(odds, vec![1, 3, 5, 7]);
/// ```
#[inline]
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
#[unstable(feature = "hash_drain_filter", issue = "59618")]
pub fn drain_filter<F>(&mut self, pred: F) -> DrainFilter<'_, K, V, F>
where
@@ -949,6 +953,7 @@ where
/// assert_eq!(map.len(), 4);
/// ```
#[inline]
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
#[stable(feature = "retain_hash_collection", since = "1.18.0")]
pub fn retain<F>(&mut self, f: F)
where
@@ -978,6 +983,7 @@ where
/// assert_eq!(vec, ["a", "b", "c"]);
/// ```
#[inline]
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
pub fn into_keys(self) -> IntoKeys<K, V> {
IntoKeys { inner: self.into_iter() }
@@ -1004,6 +1010,7 @@ where
/// assert_eq!(vec, [1, 2, 3]);
/// ```
#[inline]
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
#[stable(feature = "map_into_keys_values", since = "1.54.0")]
pub fn into_values(self) -> IntoValues<K, V> {
IntoValues { inner: self.into_iter() }
@@ -1969,6 +1976,7 @@ impl<'a, K, V, S> IntoIterator for &'a HashMap<K, V, S> {
type IntoIter = Iter<'a, K, V>;
#[inline]
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
fn into_iter(self) -> Iter<'a, K, V> {
self.iter()
}
@@ -1980,6 +1988,7 @@ impl<'a, K, V, S> IntoIterator for &'a mut HashMap<K, V, S> {
type IntoIter = IterMut<'a, K, V>;
#[inline]
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
fn into_iter(self) -> IterMut<'a, K, V> {
self.iter_mut()
}
@@ -2008,6 +2017,7 @@ impl<K, V, S> IntoIterator for HashMap<K, V, S> {
/// let vec: Vec<(&str, i32)> = map.into_iter().collect();
/// ```
#[inline]
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
fn into_iter(self) -> IntoIter<K, V> {
IntoIter { base: self.base.into_iter() }
}

View File

@@ -185,6 +185,7 @@ impl<T, S> HashSet<T, S> {
/// }
/// ```
#[inline]
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<'_, T> {
Iter { base: self.base.iter() }
@@ -244,6 +245,7 @@ impl<T, S> HashSet<T, S> {
/// assert!(set.is_empty());
/// ```
#[inline]
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
#[stable(feature = "drain", since = "1.6.0")]
pub fn drain(&mut self) -> Drain<'_, T> {
Drain { base: self.base.drain() }
@@ -282,6 +284,7 @@ impl<T, S> HashSet<T, S> {
/// assert_eq!(odds, vec![1, 3, 5, 7]);
/// ```
#[inline]
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
#[unstable(feature = "hash_drain_filter", issue = "59618")]
pub fn drain_filter<F>(&mut self, pred: F) -> DrainFilter<'_, T, F>
where
@@ -506,6 +509,7 @@ where
/// assert_eq!(diff, [4].iter().collect());
/// ```
#[inline]
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn difference<'a>(&'a self, other: &'a HashSet<T, S>) -> Difference<'a, T, S> {
Difference { iter: self.iter(), other }
@@ -533,6 +537,7 @@ where
/// assert_eq!(diff1, [1, 4].iter().collect());
/// ```
#[inline]
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn symmetric_difference<'a>(
&'a self,
@@ -560,6 +565,7 @@ where
/// assert_eq!(intersection, [2, 3].iter().collect());
/// ```
#[inline]
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn intersection<'a>(&'a self, other: &'a HashSet<T, S>) -> Intersection<'a, T, S> {
if self.len() <= other.len() {
@@ -588,6 +594,7 @@ where
/// assert_eq!(union, [1, 2, 3, 4].iter().collect());
/// ```
#[inline]
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn union<'a>(&'a self, other: &'a HashSet<T, S>) -> Union<'a, T, S> {
if self.len() >= other.len() {
@@ -922,6 +929,7 @@ where
/// set.retain(|&k| k % 2 == 0);
/// assert_eq!(set.len(), 3);
/// ```
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
#[stable(feature = "retain_hash_collection", since = "1.18.0")]
pub fn retain<F>(&mut self, f: F)
where
@@ -1403,6 +1411,7 @@ impl<'a, T, S> IntoIterator for &'a HashSet<T, S> {
type IntoIter = Iter<'a, T>;
#[inline]
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
fn into_iter(self) -> Iter<'a, T> {
self.iter()
}
@@ -1434,6 +1443,7 @@ impl<T, S> IntoIterator for HashSet<T, S> {
/// }
/// ```
#[inline]
#[cfg_attr(not(bootstrap), rustc_lint_query_instability)]
fn into_iter(self) -> IntoIter<T> {
IntoIter { base: self.base.into_iter() }
}