about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/errors.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-06-04 18:20:40 +0000
committerbors <bors@rust-lang.org>2024-06-04 18:20:40 +0000
commit46e33045f8de696df0a21d610322b95461c6920e (patch)
tree431bf50e578d7b8c20d3af72d5efc03e96a872a3 /compiler/rustc_codegen_llvm/src/errors.rs
parent5d568ad7bd59c225a1eaaf93c7d70ffecb4dbec1 (diff)
parent708ef7955d4c326e990e5b435523c131a98c14d7 (diff)
downloadrust-46e33045f8de696df0a21d610322b95461c6920e.tar.gz
rust-46e33045f8de696df0a21d610322b95461c6920e.zip
Auto merge of #12884 - y21:issue12881, r=Alexendoo
Only run `suboptimal_flops` on inherent method calls

Fixes #12881

`suboptimal_flops` was making the wrong assumption that a `.log()` method call on a float literal must choose the inherent log method that will always have an argument present (in which case `args[0]` indexing would be fine), but that wasn't the case in the linked issue because at the point of the method call, the exact float type hadn't been inferred yet (and method selection can't select inherent methods when the exact float type has not yet been inferred, in which case it falls back to looking for trait impls and chooses the one that didn't have any parameters).

This fixes it by actually making sure it's a call to an inherent method (could also fix the linked ICE by simply using fallibly indexing via `.get()`, but this felt like it'd fix the root cause: even if there were one argument, it would still be wrong to emit a warning there because it's not the `log` method the lint was expecting). I'm not sure if we need that extra function be in `clippy_utils` but it feels like it could be useful.

changelog: Fixes an ICE in [`suboptimal_flops`]
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/errors.rs')
0 files changed, 0 insertions, 0 deletions