Fix some ~const usage in libcore

This commit is contained in:
Oli Scherer 2022-10-11 19:11:56 +00:00
parent 872a6da935
commit c787de3bbd
3 changed files with 5 additions and 5 deletions

View 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)]

View 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);
}
}

View 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