rebase and review comments

This commit is contained in:
Esteban Küber 2023-02-01 17:38:56 +00:00
parent 287cd5974c
commit 5d63e10318
24 changed files with 56 additions and 57 deletions

View File

@ -612,7 +612,7 @@ impl Diagnostic {
pub fn multipart_suggestion_with_style(
&mut self,
msg: impl Into<SubdiagnosticMessage>,
mut suggestion: Vec<(Span, String)>,
suggestion: Vec<(Span, String)>,
applicability: Applicability,
style: SuggestionStyle,
) -> &mut Self {
@ -634,7 +634,6 @@ impl Diagnostic {
None,
"suggestion must not have overlapping parts",
);
suggestion.sort_by_key(|(span, _)| (span.lo(), span.hi()));
self.push_suggestion(CodeSuggestion {
substitutions: vec![Substitution { parts }],

View File

@ -930,7 +930,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
"".to_string()
};
labels
.push((provided_span, format!("argument{} unexpected", provided_ty_name)));
.push((provided_span, format!("unexpected argument{}", provided_ty_name)));
let mut span = provided_span;
if arg_idx.index() > 0
&& let Some((_, prev)) = provided_arg_tys

View File

@ -7,7 +7,7 @@ LL | fn oom() -> ! {
| _-^^^^^^^^^^^^
LL | | loop {}
LL | | }
| |_- argument of type `core::alloc::Layout` unexpected
| |_- unexpected argument of type `core::alloc::Layout`
|
note: function defined here
--> $DIR/alloc-error-handler-bad-signature-3.rs:10:4

View File

@ -16,7 +16,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
--> $DIR/basic.rs:21:5
|
LL | extra("");
| ^^^^^ -- argument of type `&'static str` unexpected
| ^^^^^ -- unexpected argument of type `&'static str`
|
note: function defined here
--> $DIR/basic.rs:14:4

View File

@ -2,7 +2,7 @@ error[E0057]: this function takes 0 arguments but 1 argument was supplied
--> $DIR/exotic-calls.rs:2:5
|
LL | t(1i32);
| ^ ---- argument of type `i32` unexpected
| ^ ---- unexpected argument of type `i32`
|
note: callable defined here
--> $DIR/exotic-calls.rs:1:11
@ -19,7 +19,7 @@ error[E0057]: this function takes 0 arguments but 1 argument was supplied
--> $DIR/exotic-calls.rs:7:5
|
LL | t(1i32);
| ^ ---- argument of type `i32` unexpected
| ^ ---- unexpected argument of type `i32`
|
note: type parameter defined here
--> $DIR/exotic-calls.rs:6:11
@ -36,7 +36,7 @@ error[E0057]: this function takes 0 arguments but 1 argument was supplied
--> $DIR/exotic-calls.rs:16:5
|
LL | baz()(1i32)
| ^^^^^ ---- argument of type `i32` unexpected
| ^^^^^ ---- unexpected argument of type `i32`
|
note: opaque type defined here
--> $DIR/exotic-calls.rs:11:13
@ -53,7 +53,7 @@ error[E0057]: this function takes 0 arguments but 1 argument was supplied
--> $DIR/exotic-calls.rs:22:5
|
LL | x(1i32);
| ^ ---- argument of type `i32` unexpected
| ^ ---- unexpected argument of type `i32`
|
note: closure defined here
--> $DIR/exotic-calls.rs:21:13

View File

@ -2,7 +2,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
--> $DIR/extra_arguments.rs:7:3
|
LL | empty("");
| ^^^^^ -- argument of type `&'static str` unexpected
| ^^^^^ -- unexpected argument of type `&'static str`
|
note: function defined here
--> $DIR/extra_arguments.rs:1:4
@ -19,7 +19,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/extra_arguments.rs:9:3
|
LL | one_arg(1, 1);
| ^^^^^^^ - argument of type `{integer}` unexpected
| ^^^^^^^ - unexpected argument of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:2:4
@ -36,7 +36,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/extra_arguments.rs:10:3
|
LL | one_arg(1, "");
| ^^^^^^^ -- argument of type `&'static str` unexpected
| ^^^^^^^ -- unexpected argument of type `&'static str`
|
note: function defined here
--> $DIR/extra_arguments.rs:2:4
@ -53,9 +53,9 @@ error[E0061]: this function takes 1 argument but 3 arguments were supplied
--> $DIR/extra_arguments.rs:11:3
|
LL | one_arg(1, "", 1.0);
| ^^^^^^^ -- --- argument of type `{float}` unexpected
| ^^^^^^^ -- --- unexpected argument of type `{float}`
| |
| argument of type `&'static str` unexpected
| unexpected argument of type `&'static str`
|
note: function defined here
--> $DIR/extra_arguments.rs:2:4
@ -72,7 +72,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/extra_arguments.rs:13:3
|
LL | two_arg_same(1, 1, 1);
| ^^^^^^^^^^^^ - argument of type `{integer}` unexpected
| ^^^^^^^^^^^^ - unexpected argument of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:3:4
@ -89,7 +89,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/extra_arguments.rs:14:3
|
LL | two_arg_same(1, 1, 1.0);
| ^^^^^^^^^^^^ --- argument of type `{float}` unexpected
| ^^^^^^^^^^^^ --- unexpected argument of type `{float}`
|
note: function defined here
--> $DIR/extra_arguments.rs:3:4
@ -106,7 +106,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/extra_arguments.rs:16:3
|
LL | two_arg_diff(1, 1, "");
| ^^^^^^^^^^^^ - argument of type `{integer}` unexpected
| ^^^^^^^^^^^^ - unexpected argument of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:4:4
@ -123,7 +123,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/extra_arguments.rs:17:3
|
LL | two_arg_diff(1, "", "");
| ^^^^^^^^^^^^ -- argument of type `&'static str` unexpected
| ^^^^^^^^^^^^ -- unexpected argument of type `&'static str`
|
note: function defined here
--> $DIR/extra_arguments.rs:4:4
@ -140,9 +140,9 @@ error[E0061]: this function takes 2 arguments but 4 arguments were supplied
--> $DIR/extra_arguments.rs:18:3
|
LL | two_arg_diff(1, 1, "", "");
| ^^^^^^^^^^^^ - -- argument of type `&'static str` unexpected
| ^^^^^^^^^^^^ - -- unexpected argument of type `&'static str`
| |
| argument of type `{integer}` unexpected
| unexpected argument of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:4:4
@ -159,9 +159,9 @@ error[E0061]: this function takes 2 arguments but 4 arguments were supplied
--> $DIR/extra_arguments.rs:19:3
|
LL | two_arg_diff(1, "", 1, "");
| ^^^^^^^^^^^^ - -- argument of type `&'static str` unexpected
| ^^^^^^^^^^^^ - -- unexpected argument of type `&'static str`
| |
| argument of type `{integer}` unexpected
| unexpected argument of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:4:4
@ -178,7 +178,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/extra_arguments.rs:22:3
|
LL | two_arg_same(1, 1, "");
| ^^^^^^^^^^^^ -- argument of type `&'static str` unexpected
| ^^^^^^^^^^^^ -- unexpected argument of type `&'static str`
|
note: function defined here
--> $DIR/extra_arguments.rs:3:4
@ -195,7 +195,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/extra_arguments.rs:23:3
|
LL | two_arg_diff(1, 1, "");
| ^^^^^^^^^^^^ - argument of type `{integer}` unexpected
| ^^^^^^^^^^^^ - unexpected argument of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:4:4
@ -215,7 +215,7 @@ LL | two_arg_same(
| ^^^^^^^^^^^^
...
LL | ""
| -- argument of type `&'static str` unexpected
| -- unexpected argument of type `&'static str`
|
note: function defined here
--> $DIR/extra_arguments.rs:3:4
@ -235,7 +235,7 @@ LL | two_arg_diff(
| ^^^^^^^^^^^^
LL | 1,
LL | 1,
| - argument of type `{integer}` unexpected
| - unexpected argument of type `{integer}`
|
note: function defined here
--> $DIR/extra_arguments.rs:4:4

View File

@ -4,7 +4,7 @@ error[E0061]: this function takes 6 arguments but 7 arguments were supplied
LL | f(C, A, A, A, B, B, C);
| ^ - - - - expected `C`, found `B`
| | | |
| | | argument of type `A` unexpected
| | | unexpected argument of type `A`
| | expected `B`, found `A`
| expected `A`, found `C`
|
@ -64,8 +64,8 @@ error[E0308]: arguments to this function are incorrect
LL | f(A, A, D, D, B, B);
| ^ - - ---- two arguments of type `C` and `C` are missing
| | |
| | argument of type `D` unexpected
| argument of type `D` unexpected
| | unexpected argument of type `D`
| unexpected argument of type `D`
|
note: function defined here
--> $DIR/issue-101097.rs:6:4

View File

@ -2,11 +2,11 @@ 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
| ^^^ - - - - unexpected argument of type `F`
| | | |
| | | expected `&E`, found `E`
| | argument of type `C` unexpected
| argument of type `B` unexpected
| | unexpected argument of type `C`
| unexpected argument of type `B`
|
note: function defined here
--> $DIR/issue-97484.rs:9:4

View File

@ -2,7 +2,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/mixed_cases.rs:10:3
|
LL | two_args(1, "", X {});
| ^^^^^^^^ -- ---- argument of type `X` unexpected
| ^^^^^^^^ -- ---- unexpected argument of type `X`
| |
| expected `f32`, found `&str`
|
@ -21,9 +21,9 @@ error[E0061]: this function takes 3 arguments but 4 arguments were supplied
--> $DIR/mixed_cases.rs:11:3
|
LL | three_args(1, "", X {}, "");
| ^^^^^^^^^^ -- ---- -- argument of type `&'static str` unexpected
| ^^^^^^^^^^ -- ---- -- unexpected argument of type `&'static str`
| | |
| | argument of type `X` unexpected
| | unexpected argument of type `X`
| an argument of type `f32` is missing
|
note: function defined here
@ -59,7 +59,7 @@ error[E0308]: arguments to this function are incorrect
--> $DIR/mixed_cases.rs:17:3
|
LL | three_args(1, "", X {});
| ^^^^^^^^^^ -- ---- argument of type `X` unexpected
| ^^^^^^^^^^ -- ---- unexpected argument of type `X`
| |
| an argument of type `f32` is missing
|

View File

@ -18,7 +18,7 @@ error[E0057]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/E0057.rs:5:13
|
LL | let c = f(2, 3);
| ^ - argument of type `{integer}` unexpected
| ^ - unexpected argument of type `{integer}`
|
note: closure defined here
--> $DIR/E0057.rs:2:13

View File

@ -2,7 +2,7 @@ error[E0057]: this function takes 0 arguments but 1 argument was supplied
--> $DIR/issue-16939.rs:5:9
|
LL | |t| f(t);
| ^ - argument unexpected
| ^ - unexpected argument
|
note: callable defined here
--> $DIR/issue-16939.rs:4:12

View File

@ -1,6 +1,6 @@
macro_rules! some_macro {
($other: expr) => ({
$other(None) //~ NOTE argument of type `Option<_>` unexpected
$other(None) //~ NOTE unexpected argument of type `Option<_>`
})
}

View File

@ -2,7 +2,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
--> $DIR/issue-26094.rs:10:17
|
LL | $other(None)
| ---- argument of type `Option<_>` unexpected
| ---- unexpected argument of type `Option<_>`
...
LL | some_macro!(some_function);
| ^^^^^^^^^^^^^

View File

@ -2,7 +2,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/issue-4935.rs:5:13
|
LL | fn main() { foo(5, 6) }
| ^^^ - argument of type `{integer}` unexpected
| ^^^ - unexpected argument of type `{integer}`
|
note: function defined here
--> $DIR/issue-4935.rs:3:4

View File

@ -2,7 +2,7 @@ error[E0061]: this method takes 0 arguments but 1 argument was supplied
--> $DIR/method-call-err-msg.rs:13:7
|
LL | x.zero(0)
| ^^^^ - argument of type `{integer}` unexpected
| ^^^^ - unexpected argument of type `{integer}`
|
note: associated function defined here
--> $DIR/method-call-err-msg.rs:5:8

View File

@ -32,7 +32,7 @@ error[E0057]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/overloaded-calls-bad.rs:37:15
|
LL | let ans = s("burma", "shave");
| ^ ------- ------- argument of type `&'static str` unexpected
| ^ ------- ------- unexpected argument of type `&'static str`
| |
| expected `isize`, found `&str`
|

View File

@ -24,7 +24,7 @@ error[E0061]: this function takes 0 arguments but 1 argument was supplied
--> $DIR/resolve-primitive-fallback.rs:3:5
|
LL | std::mem::size_of(u16);
| ^^^^^^^^^^^^^^^^^ --- argument unexpected
| ^^^^^^^^^^^^^^^^^ --- unexpected argument
|
note: function defined here
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL

View File

@ -54,7 +54,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/issue-34264.rs:7:5
|
LL | foo(Some(42), 2, "");
| ^^^ -- argument of type `&'static str` unexpected
| ^^^ -- unexpected argument of type `&'static str`
|
note: function defined here
--> $DIR/issue-34264.rs:1:4
@ -85,7 +85,7 @@ error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> $DIR/issue-34264.rs:10:5
|
LL | bar(1, 2, 3);
| ^^^ - argument of type `{integer}` unexpected
| ^^^ - unexpected argument of type `{integer}`
|
note: function defined here
--> $DIR/issue-34264.rs:3:4

View File

@ -2,7 +2,7 @@ error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
--> $DIR/args-instead-of-tuple-errors.rs:6:34
|
LL | let _: Option<(i32, bool)> = Some(1, 2);
| ^^^^ - argument of type `{integer}` unexpected
| ^^^^ - unexpected argument of type `{integer}`
|
note: expected `(i32, bool)`, found integer
--> $DIR/args-instead-of-tuple-errors.rs:6:39
@ -30,7 +30,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/args-instead-of-tuple-errors.rs:8:5
|
LL | int_bool(1, 2);
| ^^^^^^^^ - argument of type `{integer}` unexpected
| ^^^^^^^^ - unexpected argument of type `{integer}`
|
note: expected `(i32, bool)`, found integer
--> $DIR/args-instead-of-tuple-errors.rs:8:14

View File

@ -2,7 +2,7 @@ error[E0061]: this method takes 1 argument but 2 arguments were supplied
--> $DIR/wrong_argument_ice-3.rs:9:16
|
LL | groups.push(new_group, vec![process]);
| ^^^^ ------------- argument of type `Vec<&Process>` unexpected
| ^^^^ ------------- unexpected argument of type `Vec<&Process>`
|
note: expected `(Vec<String>, Vec<Process>)`, found `Vec<String>`
--> $DIR/wrong_argument_ice-3.rs:9:21

View File

@ -6,7 +6,7 @@ LL | (|| {})(|| {
LL | |
LL | | let b = 1;
LL | | });
| |_____- argument of type `[closure@$DIR/wrong_argument_ice-4.rs:2:13: 2:15]` unexpected
| |_____- unexpected argument of type `[closure@$DIR/wrong_argument_ice-4.rs:2:13: 2:15]`
|
note: closure defined here
--> $DIR/wrong_argument_ice-4.rs:2:6

View File

@ -11,7 +11,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/type-ascription-instead-of-initializer.rs:2:12
|
LL | let x: Vec::with_capacity(10, 20);
| ^^^^^^^^^^^^^^^^^^ -- argument of type `{integer}` unexpected
| ^^^^^^^^^^^^^^^^^^ -- unexpected argument of type `{integer}`
|
note: associated function defined here
--> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL

View File

@ -2,7 +2,7 @@ error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> $DIR/remove-extra-argument.rs:6:5
|
LL | l(vec![], vec![])
| ^ ------ argument of type `Vec<_>` unexpected
| ^ ------ unexpected argument of type `Vec<_>`
|
note: function defined here
--> $DIR/remove-extra-argument.rs:3:4

View File

@ -2,7 +2,7 @@ error[E0061]: this enum variant takes 1 argument but 2 arguments were supplied
--> $DIR/struct-enum-wrong-args.rs:6:13
|
LL | let _ = Some(3, 2);
| ^^^^ - argument of type `{integer}` unexpected
| ^^^^ - unexpected argument of type `{integer}`
|
note: tuple variant defined here
--> $SRC_DIR/core/src/option.rs:LL:COL
@ -16,9 +16,9 @@ error[E0061]: this enum variant takes 1 argument but 3 arguments were supplied
--> $DIR/struct-enum-wrong-args.rs:7:13
|
LL | let _ = Ok(3, 6, 2);
| ^^ - - argument of type `{integer}` unexpected
| ^^ - - unexpected argument of type `{integer}`
| |
| argument of type `{integer}` unexpected
| unexpected argument of type `{integer}`
|
note: tuple variant defined here
--> $SRC_DIR/core/src/result.rs:LL:COL
@ -61,7 +61,7 @@ error[E0061]: this struct takes 1 argument but 2 arguments were supplied
--> $DIR/struct-enum-wrong-args.rs:10:13
|
LL | let _ = Wrapper(5, 2);
| ^^^^^^^ - argument of type `{integer}` unexpected
| ^^^^^^^ - unexpected argument of type `{integer}`
|
note: tuple struct defined here
--> $DIR/struct-enum-wrong-args.rs:2:8
@ -110,7 +110,7 @@ error[E0061]: this struct takes 2 arguments but 3 arguments were supplied
--> $DIR/struct-enum-wrong-args.rs:13:13
|
LL | let _ = DoubleWrapper(5, 2, 7);
| ^^^^^^^^^^^^^ - argument of type `{integer}` unexpected
| ^^^^^^^^^^^^^ - unexpected argument of type `{integer}`
|
note: tuple struct defined here
--> $DIR/struct-enum-wrong-args.rs:3:8