
this implements checks necessary to guarantee that we can actually perform a tail call. while extremely restrictive, this is what is documented in the RFC, and all these checks are needed for one reason or another.
46 lines
1.2 KiB
Text
46 lines
1.2 KiB
Text
error: tail calling closures directly is not allowed
|
|
--> $DIR/closure.rs:6:5
|
|
|
|
|
LL | become (|| ())();
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
help: try casting the closure to a function pointer type
|
|
|
|
|
LL | become ((|| ()) as fn() -> _)();
|
|
| + +++++++++++++
|
|
|
|
error: tail calling closures directly is not allowed
|
|
--> $DIR/closure.rs:11:5
|
|
|
|
|
LL | become (|()| ())(());
|
|
| ^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: try casting the closure to a function pointer type
|
|
|
|
|
LL | become ((|()| ()) as fn(_) -> _)(());
|
|
| + ++++++++++++++
|
|
|
|
error: tail calling closures directly is not allowed
|
|
--> $DIR/closure.rs:16:5
|
|
|
|
|
LL | become (|(), _| ())((), 1);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: try casting the closure to a function pointer type
|
|
|
|
|
LL | become ((|(), _| ()) as fn(_, _) -> _)((), 1);
|
|
| + +++++++++++++++++
|
|
|
|
error: tail calling closures directly is not allowed
|
|
--> $DIR/closure.rs:22:5
|
|
|
|
|
LL | become f((), ((), ()));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: try casting the closure to a function pointer type
|
|
|
|
|
LL | become (f as fn(_, _) -> _)((), ((), ()));
|
|
| + +++++++++++++++++
|
|
|
|
error: aborting due to 4 previous errors
|
|
|