Label argument coercion errors

This commit is contained in:
Michael Goulet 2022-08-13 05:22:47 +00:00
parent 75b7e52e92
commit b0cd1e192c
3 changed files with 9 additions and 4 deletions

View file

@ -545,7 +545,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let coerced_ty = expectation.only_has_type(self).unwrap_or(formal_input_ty);
let can_coerce = self.can_coerce(arg_ty, coerced_ty);
if !can_coerce {
return Compatibility::Incompatible(None);
return Compatibility::Incompatible(Some(ty::error::TypeError::Sorts(
ty::error::ExpectedFound::new(true, coerced_ty, arg_ty),
)));
}
// Using probe here, since we don't want this subtyping to affect inference.

View file

@ -2,7 +2,9 @@ error[E0061]: this function takes 3 arguments but 2 arguments were supplied
--> $DIR/issue-96638.rs:8:5
|
LL | f(&x, "");
| ^ -- an argument of type `usize` is missing
| ^ -- -- expected `usize`, found `&str`
| |
| an argument of type `usize` is missing
|
note: function defined here
--> $DIR/issue-96638.rs:1:4

View file

@ -2,8 +2,9 @@ error[E0061]: this function takes 4 arguments but 7 arguments were supplied
--> $DIR/issue-97484.rs:12:5
|
LL | foo(&&A, B, C, D, E, F, G);
| ^^^ - - - argument of type `F` unexpected
| | |
| ^^^ - - - - argument of type `F` unexpected
| | | |
| | | expected `&E`, found struct `E`
| | argument of type `C` unexpected
| argument of type `B` unexpected
|