about summary refs log tree commit diff
path: root/tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-abort.diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-05-23 04:45:14 +0000
committerbors <bors@rust-lang.org>2023-05-23 04:45:14 +0000
commitfe792d9f7dceac7ddb38524a15031c0ea68730fa (patch)
tree34527cd378320963dcd2e6eb8800a91f61208d6c /tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-abort.diff
parentec2f2d5e47c5bc8527037c190c06227cc01c9ca2 (diff)
parented935de08761ef3d463b7770f9c5d8b7422bed82 (diff)
downloadrust-fe792d9f7dceac7ddb38524a15031c0ea68730fa.tar.gz
rust-fe792d9f7dceac7ddb38524a15031c0ea68730fa.zip
Auto merge of #10809 - nyurik:match-unsafe, r=Jarcho
Fix missing block for unsafe code

If a block is declared as unsafe, it needs an extra layer of curly braces around it.

Fixes #10808

This code adds handling for `UnsafeSource::UserProvided` block, i.e. `unsafe { ... }`. Note that we do not handle the `UnsafeSource::CompilerGenerated` as it seems to not be possible to generate that with the user code (?), or at least doesn't seem to be needed to be handled explicitly.

There is an issue with this code: it does not add an extra indentation for the unsafe blocks. I think this is a relatively minor concern for such an edge case, and should probably be done by a separate PR (fixing compile bug is more important than getting styling perfect especially when `rustfmt` will fix it anyway)

```rust
// original code
unsafe {
  ...
}

// code that is now generated by this PR
{ unsafe {
  ...
} }

// what we would ideally like to get
{
  unsafe {
    ...
  }
}
```

changelog: [`single_match`](https://rust-lang.github.io/rust-clippy/master/#single_match): Fix suggestion for `unsafe` blocks
Diffstat (limited to 'tests/mir-opt/lower_array_len.array_len.NormalizeArrayLen.panic-abort.diff')
0 files changed, 0 insertions, 0 deletions