about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-27 17:20:45 +0000
committerbors <bors@rust-lang.org>2024-02-27 17:20:45 +0000
commit4155becb2a39a1c898815c5538a00c18a1a95fc7 (patch)
tree1498639c1f621a6dbc938a49078320434c9f2b80 /compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp
parent10136170fe9ed01e46aeb4f4479175b79eb0e3c7 (diff)
parentc6cb0e99f3d5ed6b793f04b67d51878844bf608a (diff)
downloadrust-4155becb2a39a1c898815c5538a00c18a1a95fc7.tar.gz
rust-4155becb2a39a1c898815c5538a00c18a1a95fc7.zip
Auto merge of #12365 - Ethiraric:fix-11968, r=Alexendoo
[`unnecessary_cast`]: Avoid breaking precedence

 If the whole cast expression is a unary expression (`(*x as T)`) or an  addressof expression (`(&x as T)`), then not surrounding the suggestion  into a block risks us changing the precedence of operators if the cast  expression is followed by an operation with higher precedence than the  unary operator (`(*x as T).foo()` would become `*x.foo()`, which  changes what the `*` applies on).
The same is true if the expression encompassing the cast expression is a unary expression or an addressof expression.

The lint supports the latter case, but missed the former one. This PR fixes that.

Fixes #11968

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: [`unnecessary_cast`]: Avoid breaking precedence with unary operators (`(*x as T).foo()` --  before: `*x.foo()` -- now: `{*x}.foo()`)
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions