rust/compiler/rustc_mir_transform/src
bors d8fc819247 Auto merge of #109466 - davidlattimore:inline-arg-via-var-debug-info, r=wesleywiser
Preserve argument indexes when inlining MIR

We store argument indexes on VarDebugInfo. Unlike the previous method of relying on the variable index to know whether a variable is an argument, this survives MIR inlining.

We also no longer check if var.source_info.scope is the outermost scope. When a function gets inlined, the arguments to the inner function will no longer be in the outermost scope. What we care about though is whether they were in the outermost scope prior to inlining, which we know by whether we assigned an argument index.

Fixes #83217

I considered using `Option<NonZeroU16>` instead of `Option<u16>` to store the index. I didn't because `TypeFoldable` isn't implemented for `NonZeroU16` and because it looks like due to padding, it currently wouldn't make any difference. But I indexed from 1 anyway because (a) it'll make it easier if later it becomes worthwhile to use a `NonZeroU16` and because the arguments were previously indexed from 1, so it made for a smaller change.

This is my first PR on rust-lang/rust, so apologies if I've gotten anything not quite right.
2023-04-13 01:51:27 +00:00
..
coverage Rename Abort terminator to Terminate 2023-04-06 09:34:16 +01:00
inline Support TLS access into dylibs on Windows 2023-03-29 08:55:21 +02:00
abort_unwinding_calls.rs Add UnwindAction::Terminate 2023-04-06 09:34:16 +01:00
add_call_guards.rs UnwindAction::Terminate edge is also critical edge 2023-04-06 22:24:47 +01:00
add_moves_for_packed_drops.rs Remove DropAndReplace terminator 2023-03-07 14:25:22 +01:00
add_retag.rs Remove DropAndReplace terminator 2023-03-07 14:25:22 +01:00
check_alignment.rs Fix new usage of old api 2023-04-06 09:34:16 +01:00
check_const_item_mutation.rs Wrap the whole LocalInfo in ClearCrossCrate. 2023-03-14 20:52:42 +01:00
check_packed_ref.rs
check_unsafety.rs Rename Abort terminator to Terminate 2023-04-06 09:34:16 +01:00
cleanup_post_borrowck.rs Introduce a no-op PlaceMention statement for let _ =. 2023-03-09 17:45:13 +00:00
const_debuginfo.rs
const_goto.rs
const_prop_lint.rs Auto merge of #110031 - compiler-errors:generic-elaboration, r=b-naber 2023-04-09 00:18:10 +00:00
const_prop.rs Auto merge of #110031 - compiler-errors:generic-elaboration, r=b-naber 2023-04-09 00:18:10 +00:00
copy_prop.rs Use &IndexSlice instead of &IndexVec where possible 2023-04-02 17:35:37 -07:00
ctfe_limit.rs
dataflow_const_prop.rs Fix new usage of old api 2023-04-06 09:34:16 +01:00
dead_store_elimination.rs Introduce a no-op PlaceMention statement for let _ =. 2023-03-09 17:45:13 +00:00
deduce_param_attrs.rs Use local key in providers 2023-03-21 15:38:51 +00:00
deduplicate_blocks.rs
deref_separator.rs Wrap the whole LocalInfo in ClearCrossCrate. 2023-03-14 20:52:42 +01:00
dest_prop.rs Fix typos in compiler 2023-04-10 22:02:52 +02:00
dump_mir.rs
early_otherwise_branch.rs
elaborate_box_derefs.rs Update ty::VariantDef to use IndexVec<FieldIdx, FieldDef> 2023-03-30 09:23:40 -07:00
elaborate_drops.rs Fix new usage of old api 2023-04-06 09:34:16 +01:00
ffi_unwind_calls.rs LocalCrate key 2023-03-21 15:38:52 +00:00
function_item_references.rs Refactor unwind from Option to a new enum 2023-04-06 09:34:16 +01:00
generator.rs Preserve argument indexes when inlining MIR 2023-04-11 11:07:48 +10:00
inline.rs Rename Abort terminator to Terminate 2023-04-06 09:34:16 +01:00
instcombine.rs Move mir::Fieldabi::FieldIdx 2023-03-28 22:22:37 -07:00
large_enums.rs Remove uses of box_syntax in rustc and tools 2023-03-12 13:19:46 +00:00
lib.rs Refactor unwind from Option to a new enum 2023-04-06 09:34:16 +01:00
lower_intrinsics.rs Move mir::Fieldabi::FieldIdx 2023-03-28 22:22:37 -07:00
lower_slice_len.rs Add UnwindAction::Terminate 2023-04-06 09:34:16 +01:00
match_branches.rs
multiple_return_terminators.rs
normalize_array_len.rs
nrvo.rs Remove LocalKind::Var. 2023-03-14 20:52:42 +01:00
pass_manager.rs
remove_noop_landing_pads.rs Rename Abort terminator to Terminate 2023-04-06 09:34:16 +01:00
remove_storage_markers.rs
remove_uninit_drops.rs Move mir::Fieldabi::FieldIdx 2023-03-28 22:22:37 -07:00
remove_unneeded_drops.rs
remove_zsts.rs Generalize operation. 2023-03-13 18:22:55 +00:00
required_consts.rs
reveal_all.rs
separate_const_switch.rs Rename Abort terminator to Terminate 2023-04-06 09:34:16 +01:00
shim.rs Address review feedback 2023-04-06 09:34:16 +01:00
simplify_branches.rs
simplify_comparison_integral.rs
simplify.rs Use &IndexSlice instead of &IndexVec where possible 2023-04-02 17:35:37 -07:00
sroa.rs Move mir::Fieldabi::FieldIdx 2023-03-28 22:22:37 -07:00
ssa.rs Use &IndexSlice instead of &IndexVec where possible 2023-04-02 17:35:37 -07:00
uninhabited_enum_branching.rs
unreachable_prop.rs Fix typos in compiler 2023-04-10 22:02:52 +02:00