diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 2880ef78c8d27..33bebfc2c9ab5 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -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, }, diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs b/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs index 1d1f755947fdc..5d668fdaf80c7 100644 --- a/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs +++ b/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs @@ -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, callee_ty: Option>, + // A specific argument should be labeled, instead of all of them + expected_idx: Option, + 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( diff --git a/src/test/ui/argument-suggestions/invalid_arguments.stderr b/src/test/ui/argument-suggestions/invalid_arguments.stderr index 33f27d48fec80..303f086957853 100644 --- a/src/test/ui/argument-suggestions/invalid_arguments.stderr +++ b/src/test/ui/argument-suggestions/invalid_arguments.stderr @@ -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 diff --git a/src/test/ui/argument-suggestions/too-long.rs b/src/test/ui/argument-suggestions/too-long.rs new file mode 100644 index 0000000000000..7ec56afae1ce9 --- /dev/null +++ b/src/test/ui/argument-suggestions/too-long.rs @@ -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() {} diff --git a/src/test/ui/argument-suggestions/too-long.stderr b/src/test/ui/argument-suggestions/too-long.stderr new file mode 100644 index 0000000000000..bd430194c5edf --- /dev/null +++ b/src/test/ui/argument-suggestions/too-long.stderr @@ -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`. diff --git a/src/test/ui/associated-types/associated-type-projection-from-supertrait.stderr b/src/test/ui/associated-types/associated-type-projection-from-supertrait.stderr index b904ad102e97e..e761c6c62a6cf 100644 --- a/src/test/ui/associated-types/associated-type-projection-from-supertrait.stderr +++ b/src/test/ui/associated-types/associated-type-projection-from-supertrait.stderr @@ -10,7 +10,7 @@ note: function defined here --> $DIR/associated-type-projection-from-supertrait.rs:25:4 | LL | fn dent(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: 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 diff --git a/src/test/ui/associated-types/associated-types-path-2.stderr b/src/test/ui/associated-types/associated-types-path-2.stderr index 1d0b84d31d410..c37d469890c08 100644 --- a/src/test/ui/associated-types/associated-types-path-2.stderr +++ b/src/test/ui/associated-types/associated-types-path-2.stderr @@ -10,7 +10,7 @@ note: function defined here --> $DIR/associated-types-path-2.rs:13:8 | LL | pub fn f1(a: T, x: T::A) {} - | ^^ ---- ------- + | ^^ ------- help: change the type of the numeric literal from `i32` to `u32` | LL | f1(2i32, 4u32); diff --git a/src/test/ui/async-await/generator-desc.stderr b/src/test/ui/async-await/generator-desc.stderr index 3be8c552063e7..2494c3feb2a89 100644 --- a/src/test/ui/async-await/generator-desc.stderr +++ b/src/test/ui/async-await/generator-desc.stderr @@ -42,7 +42,7 @@ note: function defined here --> $DIR/generator-desc.rs:8:4 | LL | fn fun>(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>(f1: F, f2: F) {} - | ^^^ ----- ----- + | ^^^ ----- error: aborting due to 3 previous errors diff --git a/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr b/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr index 36551e5afc6c6..5cbdef2183114 100644 --- a/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr +++ b/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr @@ -12,7 +12,7 @@ note: function defined here --> $DIR/coerce-reborrow-multi-arg-fail.rs:1:4 | LL | fn test(_a: T, _b: T) {} - | ^^^^ ----- ----- + | ^^^^ ----- error: aborting due to previous error diff --git a/src/test/ui/coercion/coerce-to-bang.stderr b/src/test/ui/coercion/coerce-to-bang.stderr index add8f14cfa591..1207dc7e7a2ff 100644 --- a/src/test/ui/coercion/coerce-to-bang.stderr +++ b/src/test/ui/coercion/coerce-to-bang.stderr @@ -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 diff --git a/src/test/ui/fn/fn-item-type.stderr b/src/test/ui/fn/fn-item-type.stderr index ecc6485d6d2b5..f03a47d5c2c75 100644 --- a/src/test/ui/fn/fn-item-type.stderr +++ b/src/test/ui/fn/fn-item-type.stderr @@ -15,7 +15,7 @@ note: function defined here --> $DIR/fn-item-type.rs:7:4 | LL | fn eq(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(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(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(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(x: T, y: T) { } - | ^^ ---- ---- + | ^^ ---- error: aborting due to 5 previous errors diff --git a/src/test/ui/issues/issue-11374.stderr b/src/test/ui/issues/issue-11374.stderr index 3a1d43310e2fc..15b2bbeb7c295 100644 --- a/src/test/ui/issues/issue-11374.stderr +++ b/src/test/ui/issues/issue-11374.stderr @@ -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 diff --git a/src/test/ui/methods/method-call-err-msg.stderr b/src/test/ui/methods/method-call-err-msg.stderr index 690fe8fa7af10..e9b49c89bf162 100644 --- a/src/test/ui/methods/method-call-err-msg.stderr +++ b/src/test/ui/methods/method-call-err-msg.stderr @@ -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(self, _: T, _: T, _: T) -> Foo { self } - | ^^^^^ ---- ---- ---- ---- + | ^^^^^ ---- ---- ---- help: provide the arguments | LL | y.three::(/* usize */, /* usize */, /* usize */); diff --git a/src/test/ui/span/issue-34264.stderr b/src/test/ui/span/issue-34264.stderr index e676d7372e891..28a911d0c5bfa 100644 --- a/src/test/ui/span/issue-34264.stderr +++ b/src/test/ui/span/issue-34264.stderr @@ -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 diff --git a/src/test/ui/span/missing-unit-argument.stderr b/src/test/ui/span/missing-unit-argument.stderr index e68260e4a0940..d2afd277ecf79 100644 --- a/src/test/ui/span/missing-unit-argument.stderr +++ b/src/test/ui/span/missing-unit-argument.stderr @@ -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(self, _: T) { } - | ^^^^^^^ ---- ---- + | ^^^^^^^ ---- help: provide the argument | LL | S.generic::<()>(()); diff --git a/src/test/ui/traits/multidispatch-bad.stderr b/src/test/ui/traits/multidispatch-bad.stderr index 8b6e610067be1..d58f1e2d9e59c 100644 --- a/src/test/ui/traits/multidispatch-bad.stderr +++ b/src/test/ui/traits/multidispatch-bad.stderr @@ -10,7 +10,7 @@ note: function defined here --> $DIR/multidispatch-bad.rs:13:4 | LL | fn test(_: T, _: U) - | ^^^^ ---- ---- + | ^^^^ ---- help: change the type of the numeric literal from `i32` to `u32` | LL | test(22i32, 44u32); diff --git a/src/test/ui/tuple/add-tuple-within-arguments.stderr b/src/test/ui/tuple/add-tuple-within-arguments.stderr index 95df96ca0dd4f..7029d298d71e2 100644 --- a/src/test/ui/tuple/add-tuple-within-arguments.stderr +++ b/src/test/ui/tuple/add-tuple-within-arguments.stderr @@ -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"); diff --git a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr index 3241c9f8521c0..455f83f5721bd 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr @@ -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);