rust/src
bors 9af6fee87d Auto merge of #113128 - WaffleLapkin:become_trully_unuwuable, r=oli-obk,RalfJung
Support tail calls in mir via `TerminatorKind::TailCall`

This is one of the interesting bits in tail call implementation — MIR support.

This adds a new `TerminatorKind` which represents a tail call:
```rust
    TailCall {
        func: Operand<'tcx>,
        args: Vec<Operand<'tcx>>,
        fn_span: Span,
    },
```

*Structurally* this is very similar to a normal `Call` but is missing a few fields:
- `destination` — tail calls don't write to destination, instead they pass caller's destination to the callee (such that eventual `return` will write to the caller of the function that used tail call)
- `target` — similarly to `destination` tail calls pass the caller's return address to the callee, so there is nothing to do
- `unwind` — I _think_ this is applicable too, although it's a bit confusing
- `call_source` — `become` forbids operators and is not created as a lowering of something else; tail calls always come from HIR (at least for now)

It might be helpful to read the interpreter implementation to understand what `TailCall` means exactly, although I've tried documenting it too.

-----

There are a few `FIXME`-questions still left, ideally we'd be able to answer them during review ':)

-----

r? `@oli-obk`
cc `@scottmcm` `@DrMeepster` `@JakobDegen`
2024-07-08 04:35:04 +00:00
..
bootstrap Add #[must_use] attribute to several command-related methods 2024-07-06 20:47:54 +02:00
ci Make CI more agnostic of the owning GitHub organization 2024-07-04 12:34:07 +02:00
doc Rollup merge of #127236 - iawia002:wasip1-threads-doc, r=Nilstrieb 2024-07-07 14:22:00 +02:00
etc Implement x perf as a separate tool 2024-06-27 10:22:03 +02:00
librustdoc rustdoc-search: stop constructing pointless arrays in decode 2024-07-05 10:23:59 -07:00
llvm-project@c54cff0e6e Update LLVM submodule 2024-07-05 22:06:57 +08:00
rustdoc-json-types rustdoc-json: Better representation of lifetime bounds in where clauses. 2024-07-03 20:00:56 +00:00
tools Auto merge of #113128 - WaffleLapkin:become_trully_unuwuable, r=oli-obk,RalfJung 2024-07-08 04:35:04 +00:00
README.md
stage0 bump stage0 compiler 2024-06-11 15:10:03 +02:00
version set version number to 1.81.0 2024-06-07 10:37:34 +02:00

This directory contains some source code for the Rust project, including:

  • The bootstrapping build system
  • Various submodules for tools, like cargo, tidy, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.