diff options
Diffstat (limited to 'src/libcore/ops.rs')
| -rw-r--r-- | src/libcore/ops.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index 6e6f97a7af7..fee40115f39 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -1148,6 +1148,7 @@ impl<'a, T: ?Sized> DerefMut for &'a mut T { #[lang="fn"] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_paren_sugar] +#[cfg(stage0)] pub trait Fn<Args> { /// The returned type after the call operator is used. type Output; @@ -1156,10 +1157,21 @@ pub trait Fn<Args> { extern "rust-call" fn call(&self, args: Args) -> Self::Output; } +/// A version of the call operator that takes an immutable receiver. +#[lang="fn"] +#[stable(feature = "rust1", since = "1.0.0")] +#[rustc_paren_sugar] +#[cfg(not(stage0))] +pub trait Fn<Args> : FnMut<Args> { + /// This is called when the call operator is used. + extern "rust-call" fn call(&self, args: Args) -> Self::Output; +} + /// A version of the call operator that takes a mutable receiver. #[lang="fn_mut"] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_paren_sugar] +#[cfg(stage0)] pub trait FnMut<Args> { /// The returned type after the call operator is used. type Output; @@ -1168,6 +1180,16 @@ pub trait FnMut<Args> { extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; } +/// A version of the call operator that takes a mutable receiver. +#[lang="fn_mut"] +#[stable(feature = "rust1", since = "1.0.0")] +#[rustc_paren_sugar] +#[cfg(not(stage0))] +pub trait FnMut<Args> : FnOnce<Args> { + /// This is called when the call operator is used. + extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; +} + /// A version of the call operator that takes a by-value receiver. #[lang="fn_once"] #[stable(feature = "rust1", since = "1.0.0")] @@ -1180,6 +1202,7 @@ pub trait FnOnce<Args> { extern "rust-call" fn call_once(self, args: Args) -> Self::Output; } +#[cfg(stage0)] impl<F: ?Sized, A> FnMut<A> for F where F : Fn<A> { @@ -1190,6 +1213,7 @@ impl<F: ?Sized, A> FnMut<A> for F } } +#[cfg(stage0)] impl<F,A> FnOnce<A> for F where F : FnMut<A> { |
