@@ -1117,29 +1117,33 @@ impl<'a, T: ?Sized> DerefMut for &'a mut T {
11171117#[ lang="fn" ]
11181118#[ unstable( feature = "core" ,
11191119 reason = "uncertain about variadic generics, input versus associated types" ) ]
1120- pub trait Fn < Args , Result > {
1120+ #[ cfg( stage0) ]
1121+ pub trait Fn < Args , Output > {
11211122 /// This is called when the call operator is used.
1122- extern "rust-call" fn call ( & self , args : Args ) -> Result ;
1123+ extern "rust-call" fn call ( & self , args : Args ) -> Output ;
11231124}
11241125
11251126/// A version of the call operator that takes a mutable receiver.
11261127#[ lang="fn_mut" ]
11271128#[ unstable( feature = "core" ,
11281129 reason = "uncertain about variadic generics, input versus associated types" ) ]
1129- pub trait FnMut < Args , Result > {
1130+ #[ cfg( stage0) ]
1131+ pub trait FnMut < Args , Output > {
11301132 /// This is called when the call operator is used.
1131- extern "rust-call" fn call_mut ( & mut self , args : Args ) -> Result ;
1133+ extern "rust-call" fn call_mut ( & mut self , args : Args ) -> Output ;
11321134}
11331135
11341136/// A version of the call operator that takes a by-value receiver.
11351137#[ lang="fn_once" ]
11361138#[ unstable( feature = "core" ,
11371139 reason = "uncertain about variadic generics, input versus associated types" ) ]
1138- pub trait FnOnce < Args , Result > {
1140+ #[ cfg( stage0) ]
1141+ pub trait FnOnce < Args , Output > {
11391142 /// This is called when the call operator is used.
1140- extern "rust-call" fn call_once ( self , args : Args ) -> Result ;
1143+ extern "rust-call" fn call_once ( self , args : Args ) -> Output ;
11411144}
11421145
1146+ #[ cfg( stage0) ]
11431147impl < F : ?Sized , A , R > FnMut < A , R > for F
11441148 where F : Fn < A , R >
11451149{
@@ -1148,10 +1152,69 @@ impl<F: ?Sized, A, R> FnMut<A, R> for F
11481152 }
11491153}
11501154
1155+ #[ cfg( stage0) ]
11511156impl < F , A , R > FnOnce < A , R > for F
11521157 where F : FnMut < A , R >
11531158{
11541159 extern "rust-call" fn call_once ( mut self , args : A ) -> R {
11551160 self . call_mut ( args)
11561161 }
11571162}
1163+
1164+ /// A version of the call operator that takes an immutable receiver.
1165+ #[ lang="fn" ]
1166+ #[ unstable( feature = "core" ,
1167+ reason = "uncertain about variadic generics, input versus associated types" ) ]
1168+ #[ cfg( not( stage0) ) ]
1169+ pub trait Fn < Args > {
1170+ type Output ;
1171+
1172+ /// This is called when the call operator is used.
1173+ extern "rust-call" fn call ( & self , args : Args ) -> Self :: Output ;
1174+ }
1175+
1176+ /// A version of the call operator that takes a mutable receiver.
1177+ #[ lang="fn_mut" ]
1178+ #[ unstable( feature = "core" ,
1179+ reason = "uncertain about variadic generics, input versus associated types" ) ]
1180+ #[ cfg( not( stage0) ) ]
1181+ pub trait FnMut < Args > {
1182+ type Output ;
1183+
1184+ /// This is called when the call operator is used.
1185+ extern "rust-call" fn call_mut ( & mut self , args : Args ) -> Self :: Output ;
1186+ }
1187+
1188+ /// A version of the call operator that takes a by-value receiver.
1189+ #[ lang="fn_once" ]
1190+ #[ unstable( feature = "core" ,
1191+ reason = "uncertain about variadic generics, input versus associated types" ) ]
1192+ #[ cfg( not( stage0) ) ]
1193+ pub trait FnOnce < Args > {
1194+ type Output ;
1195+
1196+ /// This is called when the call operator is used.
1197+ extern "rust-call" fn call_once ( self , args : Args ) -> Self :: Output ;
1198+ }
1199+
1200+ #[ cfg( not( stage0) ) ]
1201+ impl < F : ?Sized , A > FnMut < A > for F
1202+ where F : Fn < A >
1203+ {
1204+ type Output = <F as Fn < A > >:: Output ;
1205+
1206+ extern "rust-call" fn call_mut ( & mut self , args : A ) -> <F as Fn < A > >:: Output {
1207+ self . call ( args)
1208+ }
1209+ }
1210+
1211+ #[ cfg( not( stage0) ) ]
1212+ impl < F , A > FnOnce < A > for F
1213+ where F : FnMut < A >
1214+ {
1215+ type Output = <F as FnMut < A > >:: Output ;
1216+
1217+ extern "rust-call" fn call_once ( mut self , args : A ) -> <F as FnMut < A > >:: Output {
1218+ self . call_mut ( args)
1219+ }
1220+ }
0 commit comments