about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-01-06 09:31:27 +0000
committerbors <bors@rust-lang.org>2020-01-06 09:31:27 +0000
commita80e63f3fa77792e848e3b248acf4c0acda2e310 (patch)
tree6e9574bac0128d5184af68d208b2ee8d9e98e416 /src/libcore
parent33640f0e03af2fb31ce380d5389d5545f24ce29a (diff)
parent34716a31db9371501fe98100a7aa1566f37c1d23 (diff)
downloadrust-a80e63f3fa77792e848e3b248acf4c0acda2e310.tar.gz
rust-a80e63f3fa77792e848e3b248acf4c0acda2e310.zip
Auto merge of #67917 - Dylan-DPC:rollup-id05y91, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #67800 (Fix ICE involving calling `Instance.ty` during const evaluation)
 - #67873 (change remove to have a PartialEq bound)
 - #67897 (Use `as_deref()` to replace `as_ref().map(...)`)
 - #67906 (Silence `TooGeneric` error)
 - #67912 (macros: typo fix)
 - #67915 (Use Self instead of $type)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/convert/num.rs28
-rw-r--r--src/libcore/fmt/num.rs4
-rw-r--r--src/libcore/iter/traits/accum.rs16
-rw-r--r--src/libcore/macros/mod.rs2
-rw-r--r--src/libcore/marker.rs8
-rw-r--r--src/libcore/num/bignum.rs4
6 files changed, 31 insertions, 31 deletions
diff --git a/src/libcore/convert/num.rs b/src/libcore/convert/num.rs
index 596da6f786b..752199c94b8 100644
--- a/src/libcore/convert/num.rs
+++ b/src/libcore/convert/num.rs
@@ -47,8 +47,8 @@ macro_rules! impl_from {
         #[doc = $doc]
         impl From<$Small> for $Large {
             #[inline]
-            fn from(small: $Small) -> $Large {
-                small as $Large
+            fn from(small: $Small) -> Self {
+                small as Self
             }
         }
     };
@@ -177,7 +177,7 @@ macro_rules! try_from_unbounded {
             /// is outside of the range of the target type.
             #[inline]
             fn try_from(value: $source) -> Result<Self, Self::Error> {
-                Ok(value as $target)
+                Ok(value as Self)
             }
         }
     )*}
@@ -194,9 +194,9 @@ macro_rules! try_from_lower_bounded {
             /// number type. This returns an error if the source value
             /// is outside of the range of the target type.
             #[inline]
-            fn try_from(u: $source) -> Result<$target, TryFromIntError> {
+            fn try_from(u: $source) -> Result<Self, Self::Error> {
                 if u >= 0 {
-                    Ok(u as $target)
+                    Ok(u as Self)
                 } else {
                     Err(TryFromIntError(()))
                 }
@@ -216,11 +216,11 @@ macro_rules! try_from_upper_bounded {
             /// number type. This returns an error if the source value
             /// is outside of the range of the target type.
             #[inline]
-            fn try_from(u: $source) -> Result<$target, TryFromIntError> {
-                if u > (<$target>::max_value() as $source) {
+            fn try_from(u: $source) -> Result<Self, Self::Error> {
+                if u > (Self::max_value() as $source) {
                     Err(TryFromIntError(()))
                 } else {
-                    Ok(u as $target)
+                    Ok(u as Self)
                 }
             }
         }
@@ -238,13 +238,13 @@ macro_rules! try_from_both_bounded {
             /// number type. This returns an error if the source value
             /// is outside of the range of the target type.
             #[inline]
-            fn try_from(u: $source) -> Result<$target, TryFromIntError> {
-                let min = <$target>::min_value() as $source;
-                let max = <$target>::max_value() as $source;
+            fn try_from(u: $source) -> Result<Self, Self::Error> {
+                let min = Self::min_value() as $source;
+                let max = Self::max_value() as $source;
                 if u < min || u > max {
                     Err(TryFromIntError(()))
                 } else {
-                    Ok(u as $target)
+                    Ok(u as Self)
                 }
             }
         }
@@ -385,10 +385,10 @@ macro_rules! nzint_impl_from {
         #[doc = $doc]
         impl From<$Small> for $Large {
             #[inline]
-            fn from(small: $Small) -> $Large {
+            fn from(small: $Small) -> Self {
                 // SAFETY: input type guarantees the value is non-zero
                 unsafe {
-                    <$Large>::new_unchecked(small.get().into())
+                    Self::new_unchecked(small.get().into())
                 }
             }
         }
diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs
index 7b20677ffb5..d562639a658 100644
--- a/src/libcore/fmt/num.rs
+++ b/src/libcore/fmt/num.rs
@@ -24,8 +24,8 @@ trait Int:
 
 macro_rules! doit {
     ($($t:ident)*) => ($(impl Int for $t {
-        fn zero() -> $t { 0 }
-        fn from_u8(u: u8) -> $t { u as $t }
+        fn zero() -> Self { 0 }
+        fn from_u8(u: u8) -> Self { u as Self }
         fn to_u8(&self) -> u8 { *self as u8 }
         fn to_u16(&self) -> u16 { *self as u16 }
         fn to_u32(&self) -> u32 { *self as u32 }
diff --git a/src/libcore/iter/traits/accum.rs b/src/libcore/iter/traits/accum.rs
index 65af671ddf2..55f30794af6 100644
--- a/src/libcore/iter/traits/accum.rs
+++ b/src/libcore/iter/traits/accum.rs
@@ -44,28 +44,28 @@ macro_rules! integer_sum_product {
     (@impls $zero:expr, $one:expr, #[$attr:meta], $($a:ty)*) => ($(
         #[$attr]
         impl Sum for $a {
-            fn sum<I: Iterator<Item=$a>>(iter: I) -> $a {
+            fn sum<I: Iterator<Item=Self>>(iter: I) -> Self {
                 iter.fold($zero, Add::add)
             }
         }
 
         #[$attr]
         impl Product for $a {
-            fn product<I: Iterator<Item=$a>>(iter: I) -> $a {
+            fn product<I: Iterator<Item=Self>>(iter: I) -> Self {
                 iter.fold($one, Mul::mul)
             }
         }
 
         #[$attr]
         impl<'a> Sum<&'a $a> for $a {
-            fn sum<I: Iterator<Item=&'a $a>>(iter: I) -> $a {
+            fn sum<I: Iterator<Item=&'a Self>>(iter: I) -> Self {
                 iter.fold($zero, Add::add)
             }
         }
 
         #[$attr]
         impl<'a> Product<&'a $a> for $a {
-            fn product<I: Iterator<Item=&'a $a>>(iter: I) -> $a {
+            fn product<I: Iterator<Item=&'a Self>>(iter: I) -> Self {
                 iter.fold($one, Mul::mul)
             }
         }
@@ -84,28 +84,28 @@ macro_rules! float_sum_product {
     ($($a:ident)*) => ($(
         #[stable(feature = "iter_arith_traits", since = "1.12.0")]
         impl Sum for $a {
-            fn sum<I: Iterator<Item=$a>>(iter: I) -> $a {
+            fn sum<I: Iterator<Item=Self>>(iter: I) -> Self {
                 iter.fold(0.0, Add::add)
             }
         }
 
         #[stable(feature = "iter_arith_traits", since = "1.12.0")]
         impl Product for $a {
-            fn product<I: Iterator<Item=$a>>(iter: I) -> $a {
+            fn product<I: Iterator<Item=Self>>(iter: I) -> Self {
                 iter.fold(1.0, Mul::mul)
             }
         }
 
         #[stable(feature = "iter_arith_traits", since = "1.12.0")]
         impl<'a> Sum<&'a $a> for $a {
-            fn sum<I: Iterator<Item=&'a $a>>(iter: I) -> $a {
+            fn sum<I: Iterator<Item=&'a Self>>(iter: I) -> Self {
                 iter.fold(0.0, Add::add)
             }
         }
 
         #[stable(feature = "iter_arith_traits", since = "1.12.0")]
         impl<'a> Product<&'a $a> for $a {
-            fn product<I: Iterator<Item=&'a $a>>(iter: I) -> $a {
+            fn product<I: Iterator<Item=&'a Self>>(iter: I) -> Self {
                 iter.fold(1.0, Mul::mul)
             }
         }
diff --git a/src/libcore/macros/mod.rs b/src/libcore/macros/mod.rs
index 0eb9e194236..76e58f0cc62 100644
--- a/src/libcore/macros/mod.rs
+++ b/src/libcore/macros/mod.rs
@@ -551,7 +551,7 @@ macro_rules! unreachable {
 
 /// Indicates unimplemented code by panicking with a message of "not implemented".
 ///
-/// This allows the your code to type-check, which is useful if you are prototyping or
+/// This allows your code to type-check, which is useful if you are prototyping or
 /// implementing a trait that requires multiple methods which you don't plan of using all of.
 ///
 /// The difference between `unimplemented!` and [`todo!`](macro.todo.html) is that while `todo!`
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs
index 3b98bc1c272..b4b595f330e 100644
--- a/src/libcore/marker.rs
+++ b/src/libcore/marker.rs
@@ -505,15 +505,15 @@ macro_rules! impls {
 
         #[stable(feature = "rust1", since = "1.0.0")]
         impl<T: ?Sized> Clone for $t<T> {
-            fn clone(&self) -> $t<T> {
-                $t
+            fn clone(&self) -> Self {
+                Self
             }
         }
 
         #[stable(feature = "rust1", since = "1.0.0")]
         impl<T: ?Sized> Default for $t<T> {
-            fn default() -> $t<T> {
-                $t
+            fn default() -> Self {
+                Self
             }
         }
 
diff --git a/src/libcore/num/bignum.rs b/src/libcore/num/bignum.rs
index 39cc381b64c..6f16b93d048 100644
--- a/src/libcore/num/bignum.rs
+++ b/src/libcore/num/bignum.rs
@@ -455,8 +455,8 @@ macro_rules! define_bignum {
         }
 
         impl crate::clone::Clone for $name {
-            fn clone(&self) -> $name {
-                $name { size: self.size, base: self.base }
+            fn clone(&self) -> Self {
+                Self { size: self.size, base: self.base }
             }
         }