Skip to content

Commit 06c9c59

Browse files
committed
lessen restriction in check_kind_count
1 parent 49c0b31 commit 06c9c59

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

compiler/rustc_typeck/src/astconv/generics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
409409
(required, "")
410410
};
411411

412-
let (spans, label) = if required == permitted && provided > permitted {
412+
let (spans, label) = if provided > permitted {
413413
// In the case when the user has provided too many arguments,
414414
// we want to point to the unexpected arguments.
415415
let spans: Vec<Span> = args.args[offset + permitted..offset + provided]

src/test/ui/const-generics/invalid-enum.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ LL | let _: Example<CompileFlag::A, _> = Example { x: 0 };
3232
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 const argument
3333

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

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

src/test/ui/generics/generic-impl-more-params-with-defaults.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0107]: wrong number of type arguments: expected at most 2, found 3
2-
--> $DIR/generic-impl-more-params-with-defaults.rs:13:5
2+
--> $DIR/generic-impl-more-params-with-defaults.rs:13:24
33
|
44
LL | Vec::<isize, Heap, bool>::new();
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected at most 2 type arguments
5+
| ^^^^ unexpected type argument
66

77
error: aborting due to previous error
88

src/test/ui/generics/generic-type-more-params-with-defaults.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0107]: wrong number of type arguments: expected at most 2, found 3
2-
--> $DIR/generic-type-more-params-with-defaults.rs:9:12
2+
--> $DIR/generic-type-more-params-with-defaults.rs:9:29
33
|
44
LL | let _: Vec<isize, Heap, bool>;
5-
| ^^^^^^^^^^^^^^^^^^^^^^ expected at most 2 type arguments
5+
| ^^^^ unexpected type argument
66

77
error: aborting due to previous error
88

0 commit comments

Comments
 (0)