bors
1e3f8c6e13
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
Jason Newcomb
0c72a99cac
raw_strings
Check HIR tree first.
2024-07-07 22:19:06 -04:00
Jason Newcomb
e12ff630fd
permissions_set_readonly_false
: Check HIR tree first.
2024-07-07 22:17:43 -04:00
Jason Newcomb
15eac5abd6
Simplify option_env_unwrap
.
2024-07-07 22:17:31 -04:00
Jason Newcomb
ff28de20b4
neg_cmp_op_on_partial_ord
: Delay macro check
2024-07-07 22:14:43 -04:00
Jason Newcomb
7c17dd331b
needless_for_each
: Check HIR tree first.
2024-07-07 22:14:24 -04:00
Jason Newcomb
139dad8849
mut_mut
: Delay macro check
2024-07-07 22:13:05 -04:00
Jason Newcomb
c22608823f
needless_borrowed_ref
: Check HIR tree first.
2024-07-07 22:13:05 -04:00
Jason Newcomb
58aa804ada
mismatching_type_param_order
: Delay macro check.
2024-07-07 22:06:15 -04:00
Jason Newcomb
36a14e3a12
misc
:
...
* Delay macro checks.
* Use `span_lint_hir`.
2024-07-07 22:05:26 -04:00
bors
1de41b18d2
Auto merge of #13068 - Jarcho:init_numbered, r=Alexendoo
...
Rework `init_numbered_fields`
Two behaviour changes:
* Not linting in macros
* Not linting when side effects might be reordered
changelog: `init_numbered_fields`: Don't suggest reordering side effects.
2024-07-08 00:28:03 +00:00
Jason Newcomb
5b7ffa1a63
Rework init_numbered_fields
:
...
* Only check the name of a single field
* Don't lint in macros
* Check for side effects
* Don't use a binary heap
2024-07-07 20:15:19 -04:00
Jason Newcomb
eda45aaba1
minmax
: use let chain
2024-07-07 18:12:39 -04:00
Jason Newcomb
488a545a50
map_unit_fn
: Delay macro check
2024-07-07 18:12:05 -04:00
Jason Newcomb
7a942a5c99
manual_unwrap_or_default
: Check HIR tree first.
2024-07-07 18:11:55 -04:00
Jason Newcomb
5d333e862b
manual_strip
: Delay msrv check.
2024-07-07 18:11:43 -04:00
Jason Newcomb
c0068ba5ac
manual_slice_size_calculation
: Delay constant check.
2024-07-07 18:11:05 -04:00
Jason Newcomb
03117026ae
manual_retain
: Remove redundant match.
2024-07-07 18:10:46 -04:00
Jason Newcomb
0f4cd13f66
manual_rem_euclid
: Check HIR tree first.
2024-07-07 18:08:44 -04:00
Jason Newcomb
44f87e8cc1
manual_range_patterns
: Delay macro check.
2024-07-07 18:08:11 -04:00
Jason Newcomb
2309f8e4a1
manual_non_exhaustive
: Delay msrv check.
2024-07-07 18:08:02 -04:00
Jason Newcomb
f46c981f3f
manual_main_separator_str
: Check HIR tree first.
2024-07-07 18:07:52 -04:00
Jason Newcomb
2d9e67ea8a
manual_let_else
: Delay msrv and macro checks.
2024-07-07 18:07:36 -04:00
Jason Newcomb
95348adcb9
manual_float_methods
:
...
* Check HIR tree first.
* Use `partition_in_place`.
2024-07-07 18:07:16 -04:00
Jason Newcomb
b9ba340db6
manual_bits
: Delay msrv check
2024-07-07 18:06:36 -04:00
Jason Newcomb
c0fa6a92f0
literal_representation
: Delay macro check.
2024-07-07 18:06:27 -04:00
Jason Newcomb
15f640a7cb
let_with_type_underscore
:
...
* Delay macro check.
* Use `is_from_proc_macro
2024-07-07 18:06:17 -04:00
Jason Newcomb
5332def0fd
let_underscore
: Delay macro check.
2024-07-07 18:06:00 -04:00
Jason Newcomb
fed75b3895
let_if_seq
: use array_windows
.
2024-07-07 18:05:51 -04:00
Jason Newcomb
ff4e62d3ec
len_zero
: Check HIR tree first
2024-07-07 18:05:41 -04:00
Alex Macleod
eac1aab1ff
Reduce the size of lintcheck JSON output
2024-07-07 21:05:51 +00:00
Jason Newcomb
5ae33c7699
legacy_numeric_constants
: Check HIR tree first.
2024-07-07 16:52:59 -04:00
Jason Newcomb
03036c11b3
large_include_file
: Check HIR tree first.
2024-07-07 16:52:33 -04:00
Jason Newcomb
c3dd028d3e
large_futures
: Delay macro check
2024-07-07 16:52:13 -04:00
Jason Newcomb
430c02cbd0
large_enum_variant
: Delay macro check
2024-07-07 16:51:58 -04:00
Jason Newcomb
3092c8a5fd
large_const_arrays
: Check HIR tree first.
2024-07-07 16:51:33 -04:00
Jason Newcomb
6b10b4360c
iter_without_into_iter
: Delay macro check
2024-07-07 16:51:20 -04:00
Jason Newcomb
fa1a690b23
iter_not_returning_iterator
:
...
* Check HIR tree first.
* Check name by symbol.
2024-07-07 16:43:07 -04:00
Jason Newcomb
ca5c2813eb
items_after_statements
: Do less work in the default case.
2024-07-07 16:41:36 -04:00
Jason Newcomb
aef0710054
instant_subtraction
: Reduce redundant work.
2024-07-07 16:37:51 -04:00
Jason Newcomb
dc8403f0f5
inline_fn_without_body
: inline into a single function
2024-07-07 16:37:31 -04:00
Jason Newcomb
8e2ddc800b
inherent_to_string
: Check HIR tree before checking for macros.
2024-07-07 16:35:05 -04:00
Jason Newcomb
f493d71a38
infinite_iter
: Only lock the symbol table once.
2024-07-07 16:27:27 -04:00
Jason Newcomb
c73aceb043
indexing_slicing
: Check HIR tree first.
2024-07-07 16:26:57 -04:00
Jason Newcomb
06f83b4e26
index_refutable_slice
: Check HIR tree first.
2024-07-07 16:26:42 -04:00
Jason Newcomb
b58b491d16
inconsistent_struct_constructor
: Check HIR tree first.
2024-07-07 16:26:04 -04:00
Jason Newcomb
3869e93408
ignored_unit_patterns
: Reorder checks.
2024-07-07 16:24:45 -04:00
Jason Newcomb
517e1ac225
if_then_some_else_none
: Check HIR tree before other checks.
2024-07-07 16:23:50 -04:00
Jason Newcomb
b26b820f3f
Refactor if_not_else
:
...
* Check HIR tree first.
* Merge lint calls.
2024-07-07 16:23:18 -04:00
Jason Newcomb
776a5238b7
if_let_mutex
: Use for_each_expr
.
2024-07-07 16:16:59 -04:00