about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-03-01 06:22:32 +0100
committerGitHub <noreply@github.com>2022-03-01 06:22:32 +0100
commit2353e835c5aaf977cd9e0485ad6ef13da937c2cd (patch)
treeb4cb0a0fd2c1967e3231b8b861fc0e6ce68d2bed /compiler/rustc_codegen_llvm/src
parent8d6f527530f4ba974d922269267fe89050188789 (diff)
parent75430670b33f04f2f32aa14aadb559314b573a44 (diff)
downloadrust-2353e835c5aaf977cd9e0485ad6ef13da937c2cd.tar.gz
rust-2353e835c5aaf977cd9e0485ad6ef13da937c2cd.zip
Rollup merge of #94438 - compiler-errors:check-method-inputs-once, r=davidtwco
Check method input expressions once

If the user mistakenly forgets to wrap their method args in a tuple, then the compiler tries to check that  types within the tuple match the expression args. This means we call `check_expr` once within this diagnostic code, so when we check the expr once again in `demand_compatible`, we attempt to apply expr adjustments twice, leading to ICEs.

This PR attempts to fix this by skipping the expression type check in `demand_compatible` if we have detected an method arg mismatch at all.

This does lead to a single UI test regressing slightly, due to a diagnostic disappearing, though I don't know if it is generally meaningful to even raise an type error after noting that the argument count is incorrect in a function call, since the user might be providing (in-context) meaningless expressions to the wrong method.

I can adjust this to be a bit more targeted (to just skip checking exprs in `demand_compatible` in the tuple case) if this UI test regression is a problem.

fixes #94334
cc #94291

Also drive-by fixup of `.node_type(expr.hir_id)` to `.expr_ty(expr)`, since that method exists.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions