about summary refs log tree commit diff
path: root/tests/mir-opt/dataflow-const-prop/enum.rs
AgeCommit message (Collapse)AuthorLines
2024-08-18Update mir-opt filechecksScott McMurray-5/+5
2024-06-26Use `-Zdump-mir-exclude-alloc-bytes` in some mir-opt testsJosh Stone-0/+1
2024-06-03rustfmt `tests/mir-opt`.Nicholas Nethercote-6/+21
The only non-obvious changes: - `building/storage_live_dead_in_statics.rs` has a `#[rustfmt::skip]` attribute to avoid reformating a table of data. - Two `.mir` files have slight changes involving line numbers. - In `unusual_item_types.rs` an `EMIT_MIR` annotation is moved to outside a function, which is the usual spot, because `tidy` complains if such a comment is indented. The commit also tweaks the comments in `rustfmt.toml`.
2024-06-03Reformat `mir!` macro invocations to use braces.Nicholas Nethercote-2/+2
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-04-20mir-opt tests: rename unit-test -> test-mir-passRalf Jung-1/+1
2024-03-10MIR printing: print the path of uneval'd const; refer to promoteds in a ↵Ralf Jung-1/+1
consistent way
2024-02-22[AUTO_GENERATED] Migrate compiletest to use `ui_test`-style `//@` directives许杰友 Jieyou Xu (Joe)-1/+1
2024-02-19Always evaluate free constants and statics, even if previous errors occurredOli Scherer-1/+1
2024-02-12Start blocks eagerlyNadrieril-3/+3
2024-01-22update enum.rssfzhu93-2/+0
2024-01-20finish a pattern in `enum.rs`sfzhu93-1/+1
2024-01-12update enum.rs for code reviewsfzhu93-1/+10
2024-01-11resolve code reviewssfzhu93-11/+12
2024-01-07Add FileCheck for enum.rssfzhu93-10/+62
2023-10-19Allow to run filecheck in mir-opt tests.Camille GILLOT-0/+1
2023-09-11Duplicate output for test.Camille GILLOT-0/+1
2023-09-11Handle reading statics.Camille GILLOT-0/+13
2023-09-11Support non-scalar constants.Camille GILLOT-0/+8
2023-02-18Add mir-opt test.Camille GILLOT-0/+16
2023-02-06Handle discriminants in dataflow-const-prop.Camille GILLOT-3/+42
2023-01-11Move /src/test to /testsAlbert Larsan-0/+13