rust/tests/ui/explicit-tail-calls/closure.stderr
Maybe Waffle cfb78419cd
implement checks for tail calls
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.
2024-11-29 04:44:41 +01:00

47 lines
1.2 KiB
Plaintext

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