remove feature gate and cleanup code
This commit is contained in:
parent
3b263ceb5c
commit
69d2d735bc
10 changed files with 18 additions and 99 deletions
|
@ -894,7 +894,6 @@ impl<'a> AstValidator<'a> {
|
|||
/// Checks that generic parameters are in the correct order,
|
||||
/// which is lifetimes, then types and then consts. (`<'a, T, const N: usize>`)
|
||||
fn validate_generic_param_order(
|
||||
sess: &Session,
|
||||
handler: &rustc_errors::Handler,
|
||||
generics: &[GenericParam],
|
||||
span: Span,
|
||||
|
@ -911,8 +910,7 @@ fn validate_generic_param_order(
|
|||
GenericParamKind::Type { default: _ } => (ParamKindOrd::Type, ident.to_string()),
|
||||
GenericParamKind::Const { ref ty, kw_span: _, default: _ } => {
|
||||
let ty = pprust::ty_to_string(ty);
|
||||
let unordered = sess.features_untracked().unordered_const_ty_params();
|
||||
(ParamKindOrd::Const { unordered }, format!("const {}: {}", ident, ty))
|
||||
(ParamKindOrd::Const, format!("const {}: {}", ident, ty))
|
||||
}
|
||||
};
|
||||
param_idents.push((kind, ord_kind, bounds, idx, ident));
|
||||
|
@ -968,14 +966,7 @@ fn validate_generic_param_order(
|
|||
);
|
||||
err.span_suggestion(
|
||||
span,
|
||||
&format!(
|
||||
"reorder the parameters: lifetimes, {}",
|
||||
if sess.features_untracked().unordered_const_ty_params() {
|
||||
"then consts and types"
|
||||
} else {
|
||||
"then types, then consts"
|
||||
}
|
||||
),
|
||||
"reorder the parameters: lifetimes, then consts and types",
|
||||
ordered_params.clone(),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
|
@ -1342,8 +1333,6 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
|||
}
|
||||
|
||||
fn visit_generics(&mut self, generics: &'a Generics) {
|
||||
let cg_defaults = self.session.features_untracked().unordered_const_ty_params();
|
||||
|
||||
let mut prev_param_default = None;
|
||||
for param in &generics.params {
|
||||
match param.kind {
|
||||
|
@ -1358,12 +1347,6 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
|||
span,
|
||||
"generic parameters with a default must be trailing",
|
||||
);
|
||||
if matches!(param.kind, GenericParamKind::Const { .. }) && !cg_defaults {
|
||||
err.note(
|
||||
"using type defaults and const parameters \
|
||||
in the same parameter list is currently not permitted",
|
||||
);
|
||||
}
|
||||
err.emit();
|
||||
break;
|
||||
}
|
||||
|
@ -1371,12 +1354,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
validate_generic_param_order(
|
||||
self.session,
|
||||
self.err_handler(),
|
||||
&generics.params,
|
||||
generics.span,
|
||||
);
|
||||
validate_generic_param_order(self.err_handler(), &generics.params, generics.span);
|
||||
|
||||
for predicate in &generics.where_clause.predicates {
|
||||
if let WherePredicate::EqPredicate(ref predicate) = *predicate {
|
||||
|
|
|
@ -724,10 +724,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) {
|
|||
gate_all!(half_open_range_patterns, "half-open range patterns are unstable");
|
||||
gate_all!(inline_const, "inline-const is experimental");
|
||||
gate_all!(inline_const_pat, "inline-const in pattern position is experimental");
|
||||
gate_all!(
|
||||
const_generics_defaults,
|
||||
"default values for const generic parameters are experimental"
|
||||
);
|
||||
if sess.parse_sess.span_diagnostic.err_count() == 0 {
|
||||
// Errors for `destructuring_assignment` can get quite noisy, especially where `_` is
|
||||
// involved, so we only emit errors where there are no other parsing errors.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue