Rollup merge of #86148 - FabianWolff:issue-85855, r=varkor

Check the number of generic lifetime and const parameters of intrinsics

This pull request fixes #85855. The current code for type checking intrinsics only checks the number of generic _type_ parameters, but does not check for an incorrect number of lifetime or const parameters, which can cause problems later on, such as the ICE in #85855, where the code thought that it was looking at a type parameter but found a lifetime parameter:
```
error: internal compiler error: compiler/rustc_middle/src/ty/generics.rs:188:18:
    expected type parameter, but found another generic parameter
```

The changes in this PR add checks for the number of lifetime and const parameters, expand the scope of `E0094` to also apply to these cases, and improve the error message by properly pluralizing the number of expected generic parameters.
This commit is contained in:
Yuki Okushi 2021-07-02 06:20:28 +09:00 committed by GitHub
commit ab4d16fe7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 83 additions and 32 deletions

View file

@ -1,4 +1,4 @@
An invalid number of type parameters was given to an intrinsic function.
An invalid number of generic parameters was passed to an intrinsic function.
Erroneous code example: