File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -1142,3 +1142,52 @@ pub trait FnOnce<Args> {
11421142 /// This is called when the call operator is used.
11431143 extern "rust-call" fn call_once ( self , args : Args ) -> Self :: Output ;
11441144}
1145+
1146+ #[ cfg( not( stage0) ) ]
1147+ mod impls {
1148+ use marker:: Sized ;
1149+ use super :: { Fn , FnMut , FnOnce } ;
1150+
1151+ impl < ' a , A , F : ?Sized > Fn < A > for & ' a F
1152+ where F : Fn < A >
1153+ {
1154+ extern "rust-call" fn call ( & self , args : A ) -> F :: Output {
1155+ ( * * self ) . call ( args)
1156+ }
1157+ }
1158+
1159+ impl < ' a , A , F : ?Sized > FnMut < A > for & ' a F
1160+ where F : Fn < A >
1161+ {
1162+ extern "rust-call" fn call_mut ( & mut self , args : A ) -> F :: Output {
1163+ ( * * self ) . call ( args)
1164+ }
1165+ }
1166+
1167+ impl < ' a , A , F : ?Sized > FnOnce < A > for & ' a F
1168+ where F : Fn < A >
1169+ {
1170+ type Output = F :: Output ;
1171+
1172+ extern "rust-call" fn call_once ( self , args : A ) -> F :: Output {
1173+ ( * self ) . call ( args)
1174+ }
1175+ }
1176+
1177+ impl < ' a , A , F : ?Sized > FnMut < A > for & ' a mut F
1178+ where F : FnMut < A >
1179+ {
1180+ extern "rust-call" fn call_mut ( & mut self , args : A ) -> F :: Output {
1181+ ( * self ) . call_mut ( args)
1182+ }
1183+ }
1184+
1185+ impl < ' a , A , F : ?Sized > FnOnce < A > for & ' a mut F
1186+ where F : FnMut < A >
1187+ {
1188+ type Output = F :: Output ;
1189+ extern "rust-call" fn call_once ( mut self , args : A ) -> F :: Output {
1190+ ( * self ) . call_mut ( args)
1191+ }
1192+ }
1193+ }
You can’t perform that action at this time.
0 commit comments