about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2023-05-07 14:12:16 +0900
committerGitHub <noreply@github.com>2023-05-07 14:12:16 +0900
commit88a0204fcb6608862834f8b2c898168881fd3b9e (patch)
tree22553152ecb89dd83731eaf620ccaa9b28f965eb /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
parent4e4e5bf17d6f7ed6876b4172a634d61c86e02e8c (diff)
parentfaa797e7e7bd75fd7dfd5a08fe8cf7bf82e02fd8 (diff)
downloadrust-88a0204fcb6608862834f8b2c898168881fd3b9e.tar.gz
rust-88a0204fcb6608862834f8b2c898168881fd3b9e.zip
Rollup merge of #111300 - Flying-Toast:while_true_span_condition, r=compiler-errors
Emit while_true lint spanning the entire loop condition

The lint that suggests `loop {}` instead of `while true {}` has functionality to 'pierce' parenthesis in cases like `while (true) {}`. In these cases, the emitted span only went to the hi of the `true` itself, not spanning the entire loop condition.

Before:
```
warning: denote infinite loops with `loop { ... }`
 --> /tmp/foobar.rs:2:5
  |
2 |     while ((((((true)))))) {}
  |     ^^^^^^^^^^^^^^^^ help: use `loop`
  |
  = note: `#[warn(while_true)]` on by default
```

After:
```
warning: denote infinite loops with `loop { ... }`
 --> /tmp/foobar.rs:2:5
  |
2 |     while ((((((true)))))) {}
  |     ^^^^^^^^^^^^^^^^^^^^^^ help: use `loop`
  |
  = note: `#[warn(while_true)]` on by default
```

This is especially a problem for rustfix.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
0 files changed, 0 insertions, 0 deletions