Open Veykril opened 1 month ago
marking the type check result as tainted appropriately.
I've been meaning to better understand hir
in ra—do you mind pointing me to where I can try implementing a fix?
parameter type handling is here https://github.com/rust-lang/rust-analyzer/blob/3ae93bcb82b2e34754fa96d05dbcecb6de3ede0e/crates/hir-ty/src/infer.rs#L864-L885
The error flag setting (which is supposed to prevent mir building) is done here https://github.com/rust-lang/rust-analyzer/blob/3ae93bcb82b2e34754fa96d05dbcecb6de3ede0e/crates/hir-ty/src/infer.rs#L676
Originally posted by @davidbarsky in #15090
The parse tree for
fn f((arg: (usize, bool)) {}
isso its basically parses as a function with a tuple pattern containing an ident pattern and another tuple pattern, missing the closing paren for the parameter list.
The HIR is
which is expected. The mir is
which is obviously bad, we shouldn't have a mir with unknowns in it in the first place!
And hence, as it turns out, just a
fn f((a,)) {}
also reproduces this (likely any non ident pattern in a param with a missing type. We probably just forget to check the function param pattern types if they contain unknowns and marking the type check result as tainted appropriately.