Compare tuple element & arg types before suggesting a tuple

This commit is contained in:
Rob Pilling
2021-12-05 21:41:33 +00:00
parent 80059f9942
commit 54d2d30662
6 changed files with 79 additions and 32 deletions

View File

@@ -0,0 +1,13 @@
// Ensure we don't suggest tuple-wrapping when we'd end up with a type error
fn main() {
// we shouldn't suggest to fix these - `2` isn't a `bool`
let _: Option<(i32, bool)> = Some(1, 2);
//~^ ERROR this enum variant takes 1 argument but 2 arguments were supplied
int_bool(1, 2);
//~^ ERROR this function takes 1 argument but 2 arguments were supplied
}
fn int_bool(_: (i32, bool)) {
}