mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Rollup merge of #110958 - compiler-errors:stdlib-refinement, r=cuviper
Make sure that some stdlib method signatures aren't accidental refinements In the process of implementing https://rust-lang.github.io/rfcs/3245-refined-impls.html, I found a bunch of stdlib implementations that accidentally "refined" their method signatures by dropping (unnecessary) bounds. This isn't currently a problem, but may become one if/when method signature refining is stabilized in the future. Shouldn't hurt to make these signatures a bit more accurate anyways. NOTE (just to be clear lol): This does not affect behavior at all, since we don't actually take advantage of refined implementations yet!
This commit is contained in:
commit
339786e012
@ -1543,11 +1543,17 @@ impl<'a, K: 'a, V: 'a> Iterator for Iter<'a, K, V> {
|
||||
self.next_back()
|
||||
}
|
||||
|
||||
fn min(mut self) -> Option<(&'a K, &'a V)> {
|
||||
fn min(mut self) -> Option<(&'a K, &'a V)>
|
||||
where
|
||||
(&'a K, &'a V): Ord,
|
||||
{
|
||||
self.next()
|
||||
}
|
||||
|
||||
fn max(mut self) -> Option<(&'a K, &'a V)> {
|
||||
fn max(mut self) -> Option<(&'a K, &'a V)>
|
||||
where
|
||||
(&'a K, &'a V): Ord,
|
||||
{
|
||||
self.next_back()
|
||||
}
|
||||
}
|
||||
@ -1612,11 +1618,17 @@ impl<'a, K, V> Iterator for IterMut<'a, K, V> {
|
||||
self.next_back()
|
||||
}
|
||||
|
||||
fn min(mut self) -> Option<(&'a K, &'a mut V)> {
|
||||
fn min(mut self) -> Option<(&'a K, &'a mut V)>
|
||||
where
|
||||
(&'a K, &'a mut V): Ord,
|
||||
{
|
||||
self.next()
|
||||
}
|
||||
|
||||
fn max(mut self) -> Option<(&'a K, &'a mut V)> {
|
||||
fn max(mut self) -> Option<(&'a K, &'a mut V)>
|
||||
where
|
||||
(&'a K, &'a mut V): Ord,
|
||||
{
|
||||
self.next_back()
|
||||
}
|
||||
}
|
||||
@ -1779,11 +1791,17 @@ impl<'a, K, V> Iterator for Keys<'a, K, V> {
|
||||
self.next_back()
|
||||
}
|
||||
|
||||
fn min(mut self) -> Option<&'a K> {
|
||||
fn min(mut self) -> Option<&'a K>
|
||||
where
|
||||
&'a K: Ord,
|
||||
{
|
||||
self.next()
|
||||
}
|
||||
|
||||
fn max(mut self) -> Option<&'a K> {
|
||||
fn max(mut self) -> Option<&'a K>
|
||||
where
|
||||
&'a K: Ord,
|
||||
{
|
||||
self.next_back()
|
||||
}
|
||||
}
|
||||
@ -2008,11 +2026,17 @@ impl<'a, K, V> Iterator for Range<'a, K, V> {
|
||||
self.next_back()
|
||||
}
|
||||
|
||||
fn min(mut self) -> Option<(&'a K, &'a V)> {
|
||||
fn min(mut self) -> Option<(&'a K, &'a V)>
|
||||
where
|
||||
(&'a K, &'a V): Ord,
|
||||
{
|
||||
self.next()
|
||||
}
|
||||
|
||||
fn max(mut self) -> Option<(&'a K, &'a V)> {
|
||||
fn max(mut self) -> Option<(&'a K, &'a V)>
|
||||
where
|
||||
(&'a K, &'a V): Ord,
|
||||
{
|
||||
self.next_back()
|
||||
}
|
||||
}
|
||||
@ -2081,11 +2105,17 @@ impl<K, V, A: Allocator + Clone> Iterator for IntoKeys<K, V, A> {
|
||||
self.next_back()
|
||||
}
|
||||
|
||||
fn min(mut self) -> Option<K> {
|
||||
fn min(mut self) -> Option<K>
|
||||
where
|
||||
K: Ord,
|
||||
{
|
||||
self.next()
|
||||
}
|
||||
|
||||
fn max(mut self) -> Option<K> {
|
||||
fn max(mut self) -> Option<K>
|
||||
where
|
||||
K: Ord,
|
||||
{
|
||||
self.next_back()
|
||||
}
|
||||
}
|
||||
@ -2204,11 +2234,17 @@ impl<'a, K, V> Iterator for RangeMut<'a, K, V> {
|
||||
self.next_back()
|
||||
}
|
||||
|
||||
fn min(mut self) -> Option<(&'a K, &'a mut V)> {
|
||||
fn min(mut self) -> Option<(&'a K, &'a mut V)>
|
||||
where
|
||||
(&'a K, &'a mut V): Ord,
|
||||
{
|
||||
self.next()
|
||||
}
|
||||
|
||||
fn max(mut self) -> Option<(&'a K, &'a mut V)> {
|
||||
fn max(mut self) -> Option<(&'a K, &'a mut V)>
|
||||
where
|
||||
(&'a K, &'a mut V): Ord,
|
||||
{
|
||||
self.next_back()
|
||||
}
|
||||
}
|
||||
|
@ -1501,11 +1501,17 @@ impl<'a, T> Iterator for Iter<'a, T> {
|
||||
self.next_back()
|
||||
}
|
||||
|
||||
fn min(mut self) -> Option<&'a T> {
|
||||
fn min(mut self) -> Option<&'a T>
|
||||
where
|
||||
&'a T: Ord,
|
||||
{
|
||||
self.next()
|
||||
}
|
||||
|
||||
fn max(mut self) -> Option<&'a T> {
|
||||
fn max(mut self) -> Option<&'a T>
|
||||
where
|
||||
&'a T: Ord,
|
||||
{
|
||||
self.next_back()
|
||||
}
|
||||
}
|
||||
@ -1604,11 +1610,17 @@ impl<'a, T> Iterator for Range<'a, T> {
|
||||
self.next_back()
|
||||
}
|
||||
|
||||
fn min(mut self) -> Option<&'a T> {
|
||||
fn min(mut self) -> Option<&'a T>
|
||||
where
|
||||
&'a T: Ord,
|
||||
{
|
||||
self.next()
|
||||
}
|
||||
|
||||
fn max(mut self) -> Option<&'a T> {
|
||||
fn max(mut self) -> Option<&'a T>
|
||||
where
|
||||
&'a T: Ord,
|
||||
{
|
||||
self.next_back()
|
||||
}
|
||||
}
|
||||
|
@ -2815,7 +2815,7 @@ impl<'a, T: 'a + Copy, A: Allocator> Extend<&'a T> for VecDeque<T, A> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn extend_one(&mut self, &elem: &T) {
|
||||
fn extend_one(&mut self, &elem: &'a T) {
|
||||
self.push_back(elem);
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ where
|
||||
impl<'a, T, const N: usize> TryFrom<&'a [T]> for &'a [T; N] {
|
||||
type Error = TryFromSliceError;
|
||||
|
||||
fn try_from(slice: &[T]) -> Result<&[T; N], TryFromSliceError> {
|
||||
fn try_from(slice: &'a [T]) -> Result<&'a [T; N], TryFromSliceError> {
|
||||
if slice.len() == N {
|
||||
let ptr = slice.as_ptr() as *const [T; N];
|
||||
// SAFETY: ok because we just checked that the length fits
|
||||
@ -275,7 +275,7 @@ impl<'a, T, const N: usize> TryFrom<&'a [T]> for &'a [T; N] {
|
||||
impl<'a, T, const N: usize> TryFrom<&'a mut [T]> for &'a mut [T; N] {
|
||||
type Error = TryFromSliceError;
|
||||
|
||||
fn try_from(slice: &mut [T]) -> Result<&mut [T; N], TryFromSliceError> {
|
||||
fn try_from(slice: &'a mut [T]) -> Result<&'a mut [T; N], TryFromSliceError> {
|
||||
if slice.len() == N {
|
||||
let ptr = slice.as_mut_ptr() as *mut [T; N];
|
||||
// SAFETY: ok because we just checked that the length fits
|
||||
|
@ -732,12 +732,18 @@ impl<A: Step> Iterator for ops::Range<A> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn min(mut self) -> Option<A> {
|
||||
fn min(mut self) -> Option<A>
|
||||
where
|
||||
A: Ord,
|
||||
{
|
||||
self.next()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn max(mut self) -> Option<A> {
|
||||
fn max(mut self) -> Option<A>
|
||||
where
|
||||
A: Ord,
|
||||
{
|
||||
self.next_back()
|
||||
}
|
||||
|
||||
@ -1158,12 +1164,18 @@ impl<A: Step> Iterator for ops::RangeInclusive<A> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn min(mut self) -> Option<A> {
|
||||
fn min(mut self) -> Option<A>
|
||||
where
|
||||
A: Ord,
|
||||
{
|
||||
self.next()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn max(mut self) -> Option<A> {
|
||||
fn max(mut self) -> Option<A>
|
||||
where
|
||||
A: Ord,
|
||||
{
|
||||
self.next_back()
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ macro_rules! deref_ops {
|
||||
|
||||
#[inline]
|
||||
#[must_use = "operator returns a new vector without mutating the inputs"]
|
||||
fn $call(self, rhs: &$simd) -> Self::Output {
|
||||
fn $call(self, rhs: &'rhs $simd) -> Self::Output {
|
||||
(*self).$call(*rhs)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user