]> git.lizzy.rs Git - rust.git/commitdiff
Fix some `~const` usage in libcore
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>
Tue, 11 Oct 2022 19:11:56 +0000 (19:11 +0000)
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>
Tue, 20 Dec 2022 15:01:37 +0000 (15:01 +0000)
library/core/src/const_closure.rs
library/core/src/hash/mod.rs
library/core/src/ops/index.rs

index 151c8e6d8986ab58f0baaebb17bcb07ca6748563..920c31233c18799a254a9f82282f8dbc30a56371 100644 (file)
@@ -51,7 +51,7 @@ macro_rules! impl_fn_mut_tuple {
         impl<'a, $($var,)* ClosureArguments, Function, ClosureReturnValue> const
             FnOnce<ClosureArguments> for ConstFnMutClosure<($(&'a mut $var),*), Function>
         where
-            Function: ~const Fn(($(&mut $var),*), ClosureArguments) -> ClosureReturnValue+ ~const Destruct,
+            Function: ~const Fn(($(&mut $var),*), ClosureArguments) -> ClosureReturnValue + ~const Destruct,
         {
             type Output = ClosureReturnValue;
 
@@ -64,7 +64,7 @@ extern "rust-call" fn call_once(mut self, args: ClosureArguments) -> Self::Outpu
         impl<'a, $($var,)* ClosureArguments, Function, ClosureReturnValue> const
             FnMut<ClosureArguments> for ConstFnMutClosure<($(&'a mut $var),*), Function>
         where
-            Function: ~const Fn(($(&mut $var),*), ClosureArguments)-> ClosureReturnValue,
+            Function: ~const Fn(($(&mut $var),*), ClosureArguments)-> ClosureReturnValue + ~const Destruct,
         {
             extern "rust-call" fn call_mut(&mut self, args: ClosureArguments) -> Self::Output {
                 #[allow(non_snake_case)]
index c755afa39eb608de9ffffd576b0b4d5fa443b0f5..71a0d1825efec359cdf4b11fa9717ca2d082118f 100644 (file)
@@ -199,7 +199,7 @@ pub trait Hash {
     /// println!("Hash is {:x}!", hasher.finish());
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
-    fn hash<H: Hasher>(&self, state: &mut H);
+    fn hash<H: ~const Hasher>(&self, state: &mut H);
 
     /// Feeds a slice of this type into the given [`Hasher`].
     ///
@@ -980,7 +980,7 @@ fn hash<H: ~const Hasher>(&self, state: &mut H) {
     #[rustc_const_unstable(feature = "const_hash", issue = "104061")]
     impl<T: ?Sized + ~const Hash> const Hash for &mut T {
         #[inline]
-        fn hash<H: Hasher>(&self, state: &mut H) {
+        fn hash<H: ~const Hasher>(&self, state: &mut H) {
             (**self).hash(state);
         }
     }
index 5e3dc48b6ca1c1b8a8cc464162b7a598ebb767c8..228efb0bc0a5c41b95507952d0fdafaf7678a578 100644 (file)
@@ -165,7 +165,7 @@ pub trait Index<Idx: ?Sized> {
 #[doc(alias = "]")]
 #[doc(alias = "[]")]
 #[const_trait]
-pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
+pub trait IndexMut<Idx: ?Sized>: ~const Index<Idx> {
     /// Performs the mutable indexing (`container[index]`) operation.
     ///
     /// # Panics