lessen restriction in check_kind_count

This commit is contained in:
Bastian Kauschke 2020-11-13 19:12:49 +01:00
parent 49c0b318df
commit 06c9c599ed
4 changed files with 9 additions and 9 deletions

View File

@ -409,7 +409,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
(required, "")
};
let (spans, label) = if required == permitted && provided > permitted {
let (spans, label) = if provided > permitted {
// In the case when the user has provided too many arguments,
// we want to point to the unexpected arguments.
let spans: Vec<Span> = args.args[offset + permitted..offset + provided]

View File

@ -32,10 +32,10 @@ LL | let _: Example<CompileFlag::A, _> = Example { x: 0 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
error[E0107]: wrong number of type arguments: expected at most 1, found 2
--> $DIR/invalid-enum.rs:31:10
--> $DIR/invalid-enum.rs:31:34
|
LL | let _: Example<CompileFlag::A, _> = Example { x: 0 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected at most 1 type argument
| ^ unexpected type argument
|
help: If this generic argument was intended as a const parameter, try surrounding it with braces:
|
@ -49,10 +49,10 @@ LL | let _: Example<Example::ASSOC_FLAG, _> = Example { x: 0 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
error[E0107]: wrong number of type arguments: expected at most 1, found 2
--> $DIR/invalid-enum.rs:36:10
--> $DIR/invalid-enum.rs:36:39
|
LL | let _: Example<Example::ASSOC_FLAG, _> = Example { x: 0 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected at most 1 type argument
| ^ unexpected type argument
|
help: If this generic argument was intended as a const parameter, try surrounding it with braces:
|

View File

@ -1,8 +1,8 @@
error[E0107]: wrong number of type arguments: expected at most 2, found 3
--> $DIR/generic-impl-more-params-with-defaults.rs:13:5
--> $DIR/generic-impl-more-params-with-defaults.rs:13:24
|
LL | Vec::<isize, Heap, bool>::new();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected at most 2 type arguments
| ^^^^ unexpected type argument
error: aborting due to previous error

View File

@ -1,8 +1,8 @@
error[E0107]: wrong number of type arguments: expected at most 2, found 3
--> $DIR/generic-type-more-params-with-defaults.rs:9:12
--> $DIR/generic-type-more-params-with-defaults.rs:9:29
|
LL | let _: Vec<isize, Heap, bool>;
| ^^^^^^^^^^^^^^^^^^^^^^ expected at most 2 type arguments
| ^^^^ unexpected type argument
error: aborting due to previous error