rust/tests/ui/mir
Nicholas Nethercote ac24299636 Reformat mir! macro invocations to use braces.
The `mir!` macro has multiple parts:
- An optional return type annotation.
- A sequence of zero or more local declarations.
- A mandatory starting anonymous basic block, which is brace-delimited.
- A sequence of zero of more additional named basic blocks.

Some `mir!` invocations use braces with a "block" style, like so:
```
mir! {
    let _unit: ();
    {
	let non_copy = S(42);
	let ptr = std::ptr::addr_of_mut!(non_copy);
	// Inside `callee`, the first argument and `*ptr` are basically
	// aliasing places!
	Call(_unit = callee(Move(*ptr), ptr), ReturnTo(after_call), UnwindContinue())
    }
    after_call = {
	Return()
    }
}
```
Some invocations use parens with a "block" style, like so:
```
mir!(
    let x: [i32; 2];
    let one: i32;
    {
	x = [42, 43];
	one = 1;
	x = [one, 2];
	RET = Move(x);
	Return()
    }
)
```
And some invocations uses parens with a "tighter" style, like so:
```
mir!({
    SetDiscriminant(*b, 0);
    Return()
})
```
This last style is generally used for cases where just the mandatory
starting basic block is present. Its braces are placed next to the
parens.

This commit changes all `mir!` invocations to use braces with a "block"
style. Why?

- Consistency is good.

- The contents of the invocation is a block of code, so it's odd to use
  parens. They are more normally used for function-like macros.

- Most importantly, the next commit will enable rustfmt for
  `tests/mir-opt/`. rustfmt is more aggressive about formatting macros
  that use parens than macros that use braces. Without this commit's
  changes, rustfmt would break a couple of `mir!` macro invocations that
  use braces within `tests/mir-opt` by inserting an extraneous comma.
  E.g.:
  ```
  mir!(type RET = (i32, bool);, { // extraneous comma after ';'
      RET.0 = 1;
      RET.1 = true;
      Return()
  })
  ```
  Switching those `mir!` invocations to use braces avoids that problem,
  resulting in this, which is nicer to read as well as being valid
  syntax:
  ```
  mir! {
      type RET = (i32, bool);
      {
	  RET.0 = 1;
	  RET.1 = true;
	  Return()
      }
  }
  ```
2024-06-03 13:24:44 +10:00
..
alignment
auxiliary
lint Reformat mir! macro invocations to use braces. 2024-06-03 13:24:44 +10:00
mir-inlining
validate Reformat mir! macro invocations to use braces. 2024-06-03 13:24:44 +10:00
build-async-error-body-correctly.rs
build-async-error-body-correctly.stderr
checks_without_panic_impl.rs
const_eval_select_cycle.rs
debug-ref-undef.rs
drop-elaboration-after-borrowck-error.rs
drop-elaboration-after-borrowck-error.stderr
dyn_metadata_sroa.rs Stop SRoA'ing DynMetadata in MIR 2024-05-25 00:44:47 -07:00
field-projection-invariant.rs
field-projection-mutating-context2.rs
field-projection-mutating-context2.stderr
field-projection-mutating-context.rs
field-projection-mutating-context.stderr
field-ty-ascription-enums.rs
field-ty-ascription.rs
important-higher-ranked-regions.rs
inline-wrong-abi.rs
inline-wrong-abi.stderr
issue66339.rs
issue-29227.rs
issue-46845.rs
issue-60390.rs
issue-66851.rs
issue-66930.rs
issue-67639-normalization-ice.rs
issue-67710-inline-projection.rs
issue-67947.rs
issue-67947.stderr
issue-68841.rs
issue-71793-inline-args-storage.rs
issue-73914.rs
issue-74739.rs
issue-75053.rs
issue-75053.stderr
issue-75419-validation-impl-trait.rs
issue-76248.rs
issue-76375.rs
issue-76740-copy-propagation.rs
issue-76803-branches-not-same.rs
issue-77002.rs
issue-77359-simplify-arm-identity.rs
issue-77911.rs
issue-78496.rs
issue-80949.rs
issue-83499-input-output-iteration-ice.rs
issue-83499-input-output-iteration-ice.stderr
issue-89485.rs
issue-91745.rs
issue-92893.rs
issue-92893.stderr
issue-99852.rs
issue-99866.rs
issue-101844.rs
issue-102389.rs
issue-102389.stderr
issue-105809.rs
issue-106062.rs
issue-106062.stderr
issue-107678-projection-with-lifetime.rs
issue-107691.rs
issue-109004-drop-large-array.rs
issue-109743.rs
issue-112269.rs
issue-112269.stderr
issue-121103.rs
issue-121103.stderr
mir_adt_construction.rs
mir_ascription_coercion.rs
mir_assign_eval_order.rs
mir_augmented_assignments.rs
mir_autoderef.rs
mir_build_match_comparisons.rs
mir_call_with_associated_type.rs
mir_calls_to_shims.rs
mir_cast_fn_ret.rs
mir_codegen_array_2.rs
mir_codegen_array.rs
mir_codegen_call_converging.rs
mir_codegen_calls_converging_drops_2.rs
mir_codegen_calls_converging_drops.rs
mir_codegen_calls_diverging_drops.rs
mir_codegen_calls_diverging.rs
mir_codegen_calls.rs
mir_codegen_critical_edge.rs
mir_codegen_spike1.rs
mir_codegen_ssa.rs Reformat mir! macro invocations to use braces. 2024-06-03 13:24:44 +10:00
mir_codegen_switch.rs
mir_codegen_switchint.rs
mir_coercion_casts.rs
mir_coercions.rs
mir_const_prop_identity.rs
mir_const_prop_tuple_field_reorder.rs
mir_constval_adts.rs
mir_detects_invalid_ops.rs
mir_detects_invalid_ops.stderr
mir_drop_order.rs
mir_drop_panics.rs
mir_dynamic_drops_1.rs
mir_dynamic_drops_2.rs
mir_dynamic_drops_3.rs
mir_early_return_scope.rs
mir_fat_ptr_drop.rs
mir_fat_ptr.rs
mir_heavy_promoted.rs
mir_indexing_oob_1.rs
mir_indexing_oob_2.rs
mir_indexing_oob_3.rs
mir_let_chains_drop_order.rs
mir_match_arm_guard.rs
mir_match_test.rs Stabilize exclusive_range 2024-05-02 19:42:31 -04:00
mir_misc_casts.rs
mir_overflow_off.rs
mir_query_cycle.rs
mir_raw_fat_ptr.rs
mir_raw_fat_ptr.stderr
mir_refs_correct.rs
mir_small_agg_arg.rs
mir_static_subtype.rs
mir_struct_with_assoc_ty.rs
mir_temp_promotions.rs
mir_void_return_2.rs
mir_void_return.rs
mir-build-2021-closure-capture-ice-110453-1.rs
mir-build-2021-closure-capture-ice-110453-1.stderr
mir-build-2021-closure-capture-ice-110453-2.rs
mir-build-2021-closure-capture-ice-110453-2.stderr
mir-typeck-normalize-fn-sig.rs
remove-zsts-query-cycle.rs
simplify-branch-same.rs
ssa_call_ret.rs Reformat mir! macro invocations to use braces. 2024-06-03 13:24:44 +10:00
ssa-analysis-regression-50041.rs
thir-constparam-temp.rs
thir-constparam-temp.stderr
unsize-trait.rs