mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
allow unordered const/ty params if any cg feature is active
This commit is contained in:
parent
0c28e028b6
commit
4747cbb3bb
@ -332,8 +332,8 @@ pub type GenericBounds = Vec<GenericBound>;
|
|||||||
pub enum ParamKindOrd {
|
pub enum ParamKindOrd {
|
||||||
Lifetime,
|
Lifetime,
|
||||||
Type,
|
Type,
|
||||||
// `unordered` is only `true` if `sess.has_features().const_generics_defaults`
|
// `unordered` is only `true` if `sess.unordered_const_ty_params()`
|
||||||
// is active. Specifically, if it's only `min_const_generics`, it will still require
|
// returns true. Specifically, if it's only `min_const_generics`, it will still require
|
||||||
// ordering consts after types.
|
// ordering consts after types.
|
||||||
Const { unordered: bool },
|
Const { unordered: bool },
|
||||||
// `Infer` is not actually constructed directly from the AST, but is implicitly constructed
|
// `Infer` is not actually constructed directly from the AST, but is implicitly constructed
|
||||||
|
@ -1351,7 +1351,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn visit_generics(&mut self, generics: &'a Generics) {
|
fn visit_generics(&mut self, generics: &'a Generics) {
|
||||||
let cg_defaults = self.session.features_untracked().const_generics_defaults;
|
let cg_defaults = self.session.features_untracked().unordered_const_ty_params();
|
||||||
|
|
||||||
let mut prev_param_default = None;
|
let mut prev_param_default = None;
|
||||||
for param in &generics.params {
|
for param in &generics.params {
|
||||||
|
@ -71,7 +71,7 @@ macro_rules! declare_features {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn unordered_const_ty_params(&self) -> bool {
|
pub fn unordered_const_ty_params(&self) -> bool {
|
||||||
self.const_generics_defaults
|
self.const_generics_defaults || self.generic_const_exprs || self.const_param_types
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Some features are known to be incomplete and using them is likely to have
|
/// Some features are known to be incomplete and using them is likely to have
|
||||||
|
@ -3,8 +3,6 @@ error: generic parameters with a default must be trailing
|
|||||||
|
|
|
|
||||||
LL | struct Bar<T = [u8; N], const N: usize>(T);
|
LL | struct Bar<T = [u8; N], const N: usize>(T);
|
||||||
| ^
|
| ^
|
||||||
|
|
|
||||||
= note: using type defaults and const parameters in the same parameter list is currently not permitted
|
|
||||||
|
|
||||||
error[E0128]: generic parameters with a default cannot use forward declared identifiers
|
error[E0128]: generic parameters with a default cannot use forward declared identifiers
|
||||||
--> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:8:21
|
--> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:8:21
|
||||||
|
Loading…
Reference in New Issue
Block a user