1
Fork 0

Rollup merge of #80538 - JulianKnodt:err_usize, r=lcnr

Add check for `[T;N]`/`usize` mismatch in astconv

Helps clarify the issue in #80506
by adding a specific check for mismatches between [T;N] and usize.

r? `@lcnr`
This commit is contained in:
Yuki Okushi 2021-01-05 09:52:37 +09:00 committed by GitHub
commit be2a3f8642
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 95 additions and 41 deletions

View file

@ -801,6 +801,15 @@ impl GenericParamDefKind {
GenericParamDefKind::Const => "constant",
}
}
pub fn to_ord(&self, tcx: TyCtxt<'_>) -> ast::ParamKindOrd {
match self {
GenericParamDefKind::Lifetime => ast::ParamKindOrd::Lifetime,
GenericParamDefKind::Type { .. } => ast::ParamKindOrd::Type,
GenericParamDefKind::Const => {
ast::ParamKindOrd::Const { unordered: tcx.features().const_generics }
}
}
}
}
#[derive(Clone, Debug, TyEncodable, TyDecodable, HashStable)]