mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-04 02:54:00 +00:00
Rollup merge of #99646 - compiler-errors:arg-mismatch-single-arg-label, r=estebank
Only point out a single function parameter if we have a single arg incompatibility Fixes #99635
This commit is contained in:
commit
2af344595a
@ -2268,7 +2268,7 @@ impl<'a> Parser<'a> {
|
||||
attrs: attrs.into(),
|
||||
ty,
|
||||
pat,
|
||||
span: lo.to(this.token.span),
|
||||
span: lo.to(this.prev_token.span),
|
||||
id: DUMMY_NODE_ID,
|
||||
is_placeholder: false,
|
||||
},
|
||||
|
@ -440,7 +440,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
call_expr: &hir::Expr<'tcx>,
|
||||
) {
|
||||
// Next, let's construct the error
|
||||
let (error_span, full_call_span, ctor_of) = match &call_expr.kind {
|
||||
let (error_span, full_call_span, ctor_of, is_method) = match &call_expr.kind {
|
||||
hir::ExprKind::Call(
|
||||
hir::Expr { hir_id, span, kind: hir::ExprKind::Path(qpath), .. },
|
||||
_,
|
||||
@ -448,12 +448,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
if let Res::Def(DefKind::Ctor(of, _), _) =
|
||||
self.typeck_results.borrow().qpath_res(qpath, *hir_id)
|
||||
{
|
||||
(call_span, *span, Some(of))
|
||||
(call_span, *span, Some(of), false)
|
||||
} else {
|
||||
(call_span, *span, None)
|
||||
(call_span, *span, None, false)
|
||||
}
|
||||
}
|
||||
hir::ExprKind::Call(hir::Expr { span, .. }, _) => (call_span, *span, None),
|
||||
hir::ExprKind::Call(hir::Expr { span, .. }, _) => (call_span, *span, None, false),
|
||||
hir::ExprKind::MethodCall(path_segment, _, span) => {
|
||||
let ident_span = path_segment.ident.span;
|
||||
let ident_span = if let Some(args) = path_segment.args {
|
||||
@ -461,9 +461,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
} else {
|
||||
ident_span
|
||||
};
|
||||
(
|
||||
*span, ident_span, None, // methods are never ctors
|
||||
)
|
||||
// methods are never ctors
|
||||
(*span, ident_span, None, true)
|
||||
}
|
||||
k => span_bug!(call_span, "checking argument types on a non-call: `{:?}`", k),
|
||||
};
|
||||
@ -659,7 +658,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
};
|
||||
self.label_fn_like(&mut err, fn_def_id, callee_ty);
|
||||
self.label_fn_like(&mut err, fn_def_id, callee_ty, Some(mismatch_idx), is_method);
|
||||
err.emit();
|
||||
return;
|
||||
}
|
||||
@ -701,16 +700,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
|
||||
errors.drain_filter(|error| {
|
||||
let Error::Invalid(provided_idx, expected_idx, Compatibility::Incompatible(error)) = error else { return false };
|
||||
let Error::Invalid(provided_idx, expected_idx, Compatibility::Incompatible(Some(e))) = error else { return false };
|
||||
let (provided_ty, provided_span) = provided_arg_tys[*provided_idx];
|
||||
let (expected_ty, _) = formal_and_expected_inputs[*expected_idx];
|
||||
let cause = &self.misc(provided_span);
|
||||
let trace = TypeTrace::types(cause, true, expected_ty, provided_ty);
|
||||
if let Some(e) = error {
|
||||
if !matches!(trace.cause.as_failure_code(e), FailureCode::Error0308(_)) {
|
||||
self.report_and_explain_type_error(trace, e).emit();
|
||||
return true;
|
||||
}
|
||||
if !matches!(trace.cause.as_failure_code(e), FailureCode::Error0308(_)) {
|
||||
self.report_and_explain_type_error(trace, e).emit();
|
||||
return true;
|
||||
}
|
||||
false
|
||||
});
|
||||
@ -749,7 +746,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
format!("arguments to this {} are incorrect", call_name),
|
||||
);
|
||||
// Call out where the function is defined
|
||||
self.label_fn_like(&mut err, fn_def_id, callee_ty);
|
||||
self.label_fn_like(
|
||||
&mut err,
|
||||
fn_def_id,
|
||||
callee_ty,
|
||||
Some(expected_idx.as_usize()),
|
||||
is_method,
|
||||
);
|
||||
err.emit();
|
||||
return;
|
||||
}
|
||||
@ -1031,7 +1034,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
|
||||
// Call out where the function is defined
|
||||
self.label_fn_like(&mut err, fn_def_id, callee_ty);
|
||||
self.label_fn_like(&mut err, fn_def_id, callee_ty, None, is_method);
|
||||
|
||||
// And add a suggestion block for all of the parameters
|
||||
let suggestion_text = match suggestion_text {
|
||||
@ -1781,6 +1784,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
err: &mut Diagnostic,
|
||||
callable_def_id: Option<DefId>,
|
||||
callee_ty: Option<Ty<'tcx>>,
|
||||
// A specific argument should be labeled, instead of all of them
|
||||
expected_idx: Option<usize>,
|
||||
is_method: bool,
|
||||
) {
|
||||
let Some(mut def_id) = callable_def_id else {
|
||||
return;
|
||||
@ -1881,14 +1887,30 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
.get_if_local(def_id)
|
||||
.and_then(|node| node.body_id())
|
||||
.into_iter()
|
||||
.flat_map(|id| self.tcx.hir().body(id).params);
|
||||
.flat_map(|id| self.tcx.hir().body(id).params)
|
||||
.skip(if is_method { 1 } else { 0 });
|
||||
|
||||
for param in params {
|
||||
for (_, param) in params
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.filter(|(idx, _)| expected_idx.map_or(true, |expected_idx| expected_idx == *idx))
|
||||
{
|
||||
spans.push_span_label(param.span, "");
|
||||
}
|
||||
|
||||
let def_kind = self.tcx.def_kind(def_id);
|
||||
err.span_note(spans, &format!("{} defined here", def_kind.descr(def_id)));
|
||||
} else if let Some(hir::Node::Expr(e)) = self.tcx.hir().get_if_local(def_id)
|
||||
&& let hir::ExprKind::Closure(hir::Closure { body, .. }) = &e.kind
|
||||
{
|
||||
let param = expected_idx
|
||||
.and_then(|expected_idx| self.tcx.hir().body(*body).params.get(expected_idx));
|
||||
let (kind, span) = if let Some(param) = param {
|
||||
("closure parameter", param.span)
|
||||
} else {
|
||||
("closure", self.tcx.def_span(def_id))
|
||||
};
|
||||
err.span_note(span, &format!("{} defined here", kind));
|
||||
} else {
|
||||
let def_kind = self.tcx.def_kind(def_id);
|
||||
err.span_note(
|
||||
|
@ -24,7 +24,7 @@ note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:6:4
|
||||
|
|
||||
LL | fn two_arg_same(_a: i32, _b: i32) {}
|
||||
| ^^^^^^^^^^^^ ------- -------
|
||||
| ^^^^^^^^^^^^ -------
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid_arguments.rs:17:16
|
||||
@ -38,7 +38,7 @@ note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:6:4
|
||||
|
|
||||
LL | fn two_arg_same(_a: i32, _b: i32) {}
|
||||
| ^^^^^^^^^^^^ ------- -------
|
||||
| ^^^^^^^^^^^^ -------
|
||||
|
||||
error[E0308]: arguments to this function are incorrect
|
||||
--> $DIR/invalid_arguments.rs:18:3
|
||||
@ -66,7 +66,7 @@ note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:7:4
|
||||
|
|
||||
LL | fn two_arg_diff(_a: i32, _b: f32) {}
|
||||
| ^^^^^^^^^^^^ ------- -------
|
||||
| ^^^^^^^^^^^^ -------
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid_arguments.rs:20:16
|
||||
@ -80,7 +80,7 @@ note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:7:4
|
||||
|
|
||||
LL | fn two_arg_diff(_a: i32, _b: f32) {}
|
||||
| ^^^^^^^^^^^^ ------- -------
|
||||
| ^^^^^^^^^^^^ -------
|
||||
|
||||
error[E0308]: arguments to this function are incorrect
|
||||
--> $DIR/invalid_arguments.rs:21:3
|
||||
@ -108,7 +108,7 @@ note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:8:4
|
||||
|
|
||||
LL | fn three_arg_diff(_a: i32, _b: f32, _c: &str) {}
|
||||
| ^^^^^^^^^^^^^^ ------- ------- --------
|
||||
| ^^^^^^^^^^^^^^ -------
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid_arguments.rs:25:21
|
||||
@ -122,7 +122,7 @@ note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:8:4
|
||||
|
|
||||
LL | fn three_arg_diff(_a: i32, _b: f32, _c: &str) {}
|
||||
| ^^^^^^^^^^^^^^ ------- ------- --------
|
||||
| ^^^^^^^^^^^^^^ -------
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid_arguments.rs:26:26
|
||||
@ -136,7 +136,7 @@ note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:8:4
|
||||
|
|
||||
LL | fn three_arg_diff(_a: i32, _b: f32, _c: &str) {}
|
||||
| ^^^^^^^^^^^^^^ ------- ------- --------
|
||||
| ^^^^^^^^^^^^^^ --------
|
||||
|
||||
error[E0308]: arguments to this function are incorrect
|
||||
--> $DIR/invalid_arguments.rs:28:3
|
||||
@ -207,7 +207,7 @@ note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:9:4
|
||||
|
|
||||
LL | fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {}
|
||||
| ^^^^^^^^^^^^^^^^ ------- ------- --------
|
||||
| ^^^^^^^^^^^^^^^^ -------
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid_arguments.rs:35:23
|
||||
@ -221,7 +221,7 @@ note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:9:4
|
||||
|
|
||||
LL | fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {}
|
||||
| ^^^^^^^^^^^^^^^^ ------- ------- --------
|
||||
| ^^^^^^^^^^^^^^^^ -------
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/invalid_arguments.rs:36:26
|
||||
@ -235,7 +235,7 @@ note: function defined here
|
||||
--> $DIR/invalid_arguments.rs:9:4
|
||||
|
|
||||
LL | fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {}
|
||||
| ^^^^^^^^^^^^^^^^ ------- ------- --------
|
||||
| ^^^^^^^^^^^^^^^^ --------
|
||||
|
||||
error[E0308]: arguments to this function are incorrect
|
||||
--> $DIR/invalid_arguments.rs:38:3
|
||||
|
41
src/test/ui/argument-suggestions/too-long.rs
Normal file
41
src/test/ui/argument-suggestions/too-long.rs
Normal file
@ -0,0 +1,41 @@
|
||||
struct Qux;
|
||||
|
||||
impl Qux {
|
||||
fn foo(
|
||||
&self,
|
||||
a: i32,
|
||||
b: i32,
|
||||
c: i32,
|
||||
d: i32,
|
||||
e: i32,
|
||||
f: i32,
|
||||
g: i32,
|
||||
h: i32,
|
||||
i: i32,
|
||||
j: i32,
|
||||
k: i32,
|
||||
l: i32,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
fn what(
|
||||
qux: &Qux,
|
||||
a: i32,
|
||||
b: i32,
|
||||
c: i32,
|
||||
d: i32,
|
||||
e: i32,
|
||||
f: &i32,
|
||||
g: i32,
|
||||
h: i32,
|
||||
i: i32,
|
||||
j: i32,
|
||||
k: i32,
|
||||
l: i32,
|
||||
) {
|
||||
qux.foo(a, b, c, d, e, f, g, h, i, j, k, l);
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
|
||||
fn main() {}
|
24
src/test/ui/argument-suggestions/too-long.stderr
Normal file
24
src/test/ui/argument-suggestions/too-long.stderr
Normal file
@ -0,0 +1,24 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/too-long.rs:37:28
|
||||
|
|
||||
LL | qux.foo(a, b, c, d, e, f, g, h, i, j, k, l);
|
||||
| --- ^ expected `i32`, found `&i32`
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
note: associated function defined here
|
||||
--> $DIR/too-long.rs:4:8
|
||||
|
|
||||
LL | fn foo(
|
||||
| ^^^
|
||||
...
|
||||
LL | f: i32,
|
||||
| ------
|
||||
help: consider dereferencing the borrow
|
||||
|
|
||||
LL | qux.foo(a, b, c, d, e, *f, g, h, i, j, k, l);
|
||||
| +
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
@ -10,7 +10,7 @@ note: function defined here
|
||||
--> $DIR/associated-type-projection-from-supertrait.rs:25:4
|
||||
|
|
||||
LL | fn dent<C:Car>(c: C, color: C::Color) { c.chip_paint(color) }
|
||||
| ^^^^ ---- ---------------
|
||||
| ^^^^ ---------------
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/associated-type-projection-from-supertrait.rs:28:23
|
||||
@ -24,7 +24,7 @@ note: function defined here
|
||||
--> $DIR/associated-type-projection-from-supertrait.rs:25:4
|
||||
|
|
||||
LL | fn dent<C:Car>(c: C, color: C::Color) { c.chip_paint(color) }
|
||||
| ^^^^ ---- ---------------
|
||||
| ^^^^ ---------------
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/associated-type-projection-from-supertrait.rs:32:28
|
||||
@ -38,7 +38,7 @@ note: associated function defined here
|
||||
--> $DIR/associated-type-projection-from-supertrait.rs:12:8
|
||||
|
|
||||
LL | fn chip_paint(&self, c: Self::Color) { }
|
||||
| ^^^^^^^^^^ ----- --------------
|
||||
| ^^^^^^^^^^ --------------
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/associated-type-projection-from-supertrait.rs:33:28
|
||||
@ -52,7 +52,7 @@ note: associated function defined here
|
||||
--> $DIR/associated-type-projection-from-supertrait.rs:12:8
|
||||
|
|
||||
LL | fn chip_paint(&self, c: Self::Color) { }
|
||||
| ^^^^^^^^^^ ----- --------------
|
||||
| ^^^^^^^^^^ --------------
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
@ -10,7 +10,7 @@ note: function defined here
|
||||
--> $DIR/associated-types-path-2.rs:13:8
|
||||
|
|
||||
LL | pub fn f1<T: Foo>(a: T, x: T::A) {}
|
||||
| ^^ ---- -------
|
||||
| ^^ -------
|
||||
help: change the type of the numeric literal from `i32` to `u32`
|
||||
|
|
||||
LL | f1(2i32, 4u32);
|
||||
|
@ -42,7 +42,7 @@ note: function defined here
|
||||
--> $DIR/generator-desc.rs:8:4
|
||||
|
|
||||
LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
|
||||
| ^^^ ----- -----
|
||||
| ^^^ -----
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/generator-desc.rs:14:26
|
||||
@ -67,7 +67,7 @@ note: function defined here
|
||||
--> $DIR/generator-desc.rs:8:4
|
||||
|
|
||||
LL | fn fun<F: Future<Output = ()>>(f1: F, f2: F) {}
|
||||
| ^^^ ----- -----
|
||||
| ^^^ -----
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -12,7 +12,7 @@ note: function defined here
|
||||
--> $DIR/coerce-reborrow-multi-arg-fail.rs:1:4
|
||||
|
|
||||
LL | fn test<T>(_a: T, _b: T) {}
|
||||
| ^^^^ ----- -----
|
||||
| ^^^^ -----
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -12,7 +12,7 @@ note: function defined here
|
||||
--> $DIR/coerce-to-bang.rs:3:4
|
||||
|
|
||||
LL | fn foo(x: usize, y: !, z: usize) { }
|
||||
| ^^^ -------- ---- --------
|
||||
| ^^^ ----
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:18:13
|
||||
@ -28,7 +28,7 @@ note: function defined here
|
||||
--> $DIR/coerce-to-bang.rs:3:4
|
||||
|
|
||||
LL | fn foo(x: usize, y: !, z: usize) { }
|
||||
| ^^^ -------- ---- --------
|
||||
| ^^^ ----
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:26:12
|
||||
@ -44,7 +44,7 @@ note: function defined here
|
||||
--> $DIR/coerce-to-bang.rs:3:4
|
||||
|
|
||||
LL | fn foo(x: usize, y: !, z: usize) { }
|
||||
| ^^^ -------- ---- --------
|
||||
| ^^^ ----
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:36:12
|
||||
@ -60,7 +60,7 @@ note: function defined here
|
||||
--> $DIR/coerce-to-bang.rs:3:4
|
||||
|
|
||||
LL | fn foo(x: usize, y: !, z: usize) { }
|
||||
| ^^^ -------- ---- --------
|
||||
| ^^^ ----
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:45:12
|
||||
@ -76,7 +76,7 @@ note: function defined here
|
||||
--> $DIR/coerce-to-bang.rs:3:4
|
||||
|
|
||||
LL | fn foo(x: usize, y: !, z: usize) { }
|
||||
| ^^^ -------- ---- --------
|
||||
| ^^^ ----
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/coerce-to-bang.rs:50:21
|
||||
|
@ -15,7 +15,7 @@ note: function defined here
|
||||
--> $DIR/fn-item-type.rs:7:4
|
||||
|
|
||||
LL | fn eq<T>(x: T, y: T) { }
|
||||
| ^^ ---- ----
|
||||
| ^^ ----
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/fn-item-type.rs:22:19
|
||||
@ -34,7 +34,7 @@ note: function defined here
|
||||
--> $DIR/fn-item-type.rs:7:4
|
||||
|
|
||||
LL | fn eq<T>(x: T, y: T) { }
|
||||
| ^^ ---- ----
|
||||
| ^^ ----
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/fn-item-type.rs:29:23
|
||||
@ -53,7 +53,7 @@ note: function defined here
|
||||
--> $DIR/fn-item-type.rs:7:4
|
||||
|
|
||||
LL | fn eq<T>(x: T, y: T) { }
|
||||
| ^^ ---- ----
|
||||
| ^^ ----
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/fn-item-type.rs:38:26
|
||||
@ -72,7 +72,7 @@ note: function defined here
|
||||
--> $DIR/fn-item-type.rs:7:4
|
||||
|
|
||||
LL | fn eq<T>(x: T, y: T) { }
|
||||
| ^^ ---- ----
|
||||
| ^^ ----
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/fn-item-type.rs:45:19
|
||||
@ -90,7 +90,7 @@ note: function defined here
|
||||
--> $DIR/fn-item-type.rs:7:4
|
||||
|
|
||||
LL | fn eq<T>(x: T, y: T) { }
|
||||
| ^^ ---- ----
|
||||
| ^^ ----
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
@ -14,7 +14,7 @@ note: associated function defined here
|
||||
--> $DIR/issue-11374.rs:13:12
|
||||
|
|
||||
LL | pub fn read_to(&mut self, vec: &mut [u8]) {
|
||||
| ^^^^^^^ --------- --------------
|
||||
| ^^^^^^^ --------------
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,7 +8,7 @@ note: associated function defined here
|
||||
--> $DIR/method-call-err-msg.rs:5:8
|
||||
|
|
||||
LL | fn zero(self) -> Foo { self }
|
||||
| ^^^^ ----
|
||||
| ^^^^
|
||||
help: remove the extra argument
|
||||
|
|
||||
LL | x.zero()
|
||||
@ -24,7 +24,7 @@ note: associated function defined here
|
||||
--> $DIR/method-call-err-msg.rs:6:8
|
||||
|
|
||||
LL | fn one(self, _: isize) -> Foo { self }
|
||||
| ^^^ ---- --------
|
||||
| ^^^ --------
|
||||
help: provide the argument
|
||||
|
|
||||
LL | .one(/* isize */)
|
||||
@ -40,7 +40,7 @@ note: associated function defined here
|
||||
--> $DIR/method-call-err-msg.rs:7:8
|
||||
|
|
||||
LL | fn two(self, _: isize, _: isize) -> Foo { self }
|
||||
| ^^^ ---- -------- --------
|
||||
| ^^^ -------- --------
|
||||
help: provide the argument
|
||||
|
|
||||
LL | .two(0, /* isize */);
|
||||
@ -80,7 +80,7 @@ note: associated function defined here
|
||||
--> $DIR/method-call-err-msg.rs:8:8
|
||||
|
|
||||
LL | fn three<T>(self, _: T, _: T, _: T) -> Foo { self }
|
||||
| ^^^^^ ---- ---- ---- ----
|
||||
| ^^^^^ ---- ---- ----
|
||||
help: provide the arguments
|
||||
|
|
||||
LL | y.three::<usize>(/* usize */, /* usize */, /* usize */);
|
||||
|
@ -78,7 +78,7 @@ note: function defined here
|
||||
--> $DIR/issue-34264.rs:3:4
|
||||
|
|
||||
LL | fn bar(x, y: usize) {}
|
||||
| ^^^ - --------
|
||||
| ^^^ --------
|
||||
|
||||
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
|
||||
--> $DIR/issue-34264.rs:10:5
|
||||
|
@ -72,7 +72,7 @@ note: associated function defined here
|
||||
--> $DIR/missing-unit-argument.rs:6:8
|
||||
|
|
||||
LL | fn baz(self, (): ()) { }
|
||||
| ^^^ ---- ------
|
||||
| ^^^ ------
|
||||
help: provide the argument
|
||||
|
|
||||
LL | S.baz(());
|
||||
@ -88,7 +88,7 @@ note: associated function defined here
|
||||
--> $DIR/missing-unit-argument.rs:7:8
|
||||
|
|
||||
LL | fn generic<T>(self, _: T) { }
|
||||
| ^^^^^^^ ---- ----
|
||||
| ^^^^^^^ ----
|
||||
help: provide the argument
|
||||
|
|
||||
LL | S.generic::<()>(());
|
||||
|
@ -10,7 +10,7 @@ note: function defined here
|
||||
--> $DIR/multidispatch-bad.rs:13:4
|
||||
|
|
||||
LL | fn test<T,U>(_: T, _: U)
|
||||
| ^^^^ ---- ----
|
||||
| ^^^^ ----
|
||||
help: change the type of the numeric literal from `i32` to `u32`
|
||||
|
|
||||
LL | test(22i32, 44u32);
|
||||
|
@ -8,7 +8,7 @@ note: function defined here
|
||||
--> $DIR/add-tuple-within-arguments.rs:1:4
|
||||
|
|
||||
LL | fn foo(s: &str, a: (i32, i32), s2: &str) {}
|
||||
| ^^^ ------- ------------- --------
|
||||
| ^^^ -------------
|
||||
help: wrap these arguments in parentheses to construct a tuple
|
||||
|
|
||||
LL | foo("hi", (1, 2), "hi");
|
||||
@ -28,7 +28,7 @@ note: function defined here
|
||||
--> $DIR/add-tuple-within-arguments.rs:3:4
|
||||
|
|
||||
LL | fn bar(s: &str, a: (&str,), s2: &str) {}
|
||||
| ^^^ ------- ---------- --------
|
||||
| ^^^ ----------
|
||||
help: use a trailing comma to create a tuple with one element
|
||||
|
|
||||
LL | bar("hi", ("hi",), "hi");
|
||||
|
@ -6,11 +6,11 @@ LL | let z = f(1_usize, 2);
|
||||
| |
|
||||
| arguments to this function are incorrect
|
||||
|
|
||||
note: closure defined here
|
||||
--> $DIR/unboxed-closures-type-mismatch.rs:4:17
|
||||
note: closure parameter defined here
|
||||
--> $DIR/unboxed-closures-type-mismatch.rs:4:18
|
||||
|
|
||||
LL | let mut f = |x: isize, y: isize| -> isize { x + y };
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
| ^^^^^^^^
|
||||
help: change the type of the numeric literal from `usize` to `isize`
|
||||
|
|
||||
LL | let z = f(1_isize, 2);
|
||||
|
Loading…
Reference in New Issue
Block a user