1
Fork 0

remove feature gate and cleanup code

This commit is contained in:
Ellen 2021-10-23 16:57:13 +01:00
parent 3b263ceb5c
commit 69d2d735bc
10 changed files with 18 additions and 99 deletions

View file

@ -131,8 +131,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
_ => {}
}
let kind_ord = param.kind.to_ord(tcx);
let arg_ord = arg.to_ord(tcx.features());
let kind_ord = param.kind.to_ord();
let arg_ord = arg.to_ord();
// This note is only true when generic parameters are strictly ordered by their kind.
if possible_ordering_error && kind_ord.cmp(&arg_ord) != core::cmp::Ordering::Equal {
@ -298,26 +298,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
.params
.clone()
.into_iter()
.map(|param| {
(
match param.kind {
GenericParamDefKind::Lifetime => {
ParamKindOrd::Lifetime
}
GenericParamDefKind::Type { .. } => {
ParamKindOrd::Type
}
GenericParamDefKind::Const { .. } => {
ParamKindOrd::Const {
unordered: tcx
.features()
.unordered_const_ty_params(),
}
}
},
param,
)
})
.map(|param| (param.kind.to_ord(), param))
.collect::<Vec<(ParamKindOrd, GenericParamDef)>>();
param_types_present.sort_by_key(|(ord, _)| *ord);
let (mut param_types_present, ordered_params): (
@ -330,16 +311,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
tcx,
arg,
param,
!args_iter.clone().is_sorted_by_key(|arg| match arg {
GenericArg::Lifetime(_) => ParamKindOrd::Lifetime,
GenericArg::Type(_) => ParamKindOrd::Type,
GenericArg::Const(_) => ParamKindOrd::Const {
unordered: tcx
.features()
.unordered_const_ty_params(),
},
GenericArg::Infer(_) => ParamKindOrd::Infer,
}),
!args_iter.clone().is_sorted_by_key(|arg| arg.to_ord()),
Some(&format!(
"reorder the arguments: {}: `<{}>`",
param_types_present

View file

@ -696,7 +696,6 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {
hir::GenericParamKind::Lifetime { .. } | hir::GenericParamKind::Type { .. } => (),
// Const parameters are well formed if their type is structural match.
// FIXME(const_generics_defaults): we also need to check that the `default` is wf.
hir::GenericParamKind::Const { ty: hir_ty, default: _ } => {
let ty = tcx.type_of(tcx.hir().local_def_id(param.hir_id));