Skip to content

Commit

Permalink
lessen restriction in check_kind_count
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Nov 13, 2020
1 parent 49c0b31 commit 06c9c59
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_typeck/src/astconv/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/const-generics/invalid-enum.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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:
|
Expand All @@ -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:
|
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 06c9c59

Please sign in to comment.