about summary refs log tree commit diff
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2021-08-26 21:12:02 +0200
committerlcnr <rust@lcnr.de>2021-08-30 11:00:21 +0200
commit4747cbb3bbb1dd7a9f8a5bdb2eee073f8e4c43ef (patch)
tree613a2fd8b0bbff7d864d067a07d95244ee600965
parent0c28e028b6f45f33447f24de7dd762b8599b7a4e (diff)
downloadrust-4747cbb3bbb1dd7a9f8a5bdb2eee073f8e4c43ef.tar.gz
rust-4747cbb3bbb1dd7a9f8a5bdb2eee073f8e4c43ef.zip
allow unordered const/ty params if any cg feature is active
-rw-r--r--compiler/rustc_ast/src/ast.rs4
-rw-r--r--compiler/rustc_ast_passes/src/ast_validation.rs2
-rw-r--r--compiler/rustc_feature/src/active.rs2
-rw-r--r--src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.full.stderr2
4 files changed, 4 insertions, 6 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs
index d0a95ea130a..e1ea464dedb 100644
--- a/compiler/rustc_ast/src/ast.rs
+++ b/compiler/rustc_ast/src/ast.rs
@@ -332,8 +332,8 @@ pub type GenericBounds = Vec<GenericBound>;
 pub enum ParamKindOrd {
     Lifetime,
     Type,
-    // `unordered` is only `true` if `sess.has_features().const_generics_defaults`
-    // is active. Specifically, if it's only `min_const_generics`, it will still require
+    // `unordered` is only `true` if `sess.unordered_const_ty_params()`
+    // returns true. Specifically, if it's only `min_const_generics`, it will still require
     // ordering consts after types.
     Const { unordered: bool },
     // `Infer` is not actually constructed directly from the AST, but is implicitly constructed
diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs
index c0ea710fdcb..73abd2bb83b 100644
--- a/compiler/rustc_ast_passes/src/ast_validation.rs
+++ b/compiler/rustc_ast_passes/src/ast_validation.rs
@@ -1351,7 +1351,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
     }
 
     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;
         for param in &generics.params {
diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs
index e2c88835f52..79a1f4e0c5c 100644
--- a/compiler/rustc_feature/src/active.rs
+++ b/compiler/rustc_feature/src/active.rs
@@ -71,7 +71,7 @@ macro_rules! declare_features {
             }
 
             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
diff --git a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.full.stderr b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.full.stderr
index e8fd9e7769b..9f0b2efae96 100644
--- a/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.full.stderr
+++ b/src/test/ui/const-generics/params-in-ct-in-ty-param-lazy-norm.full.stderr
@@ -3,8 +3,6 @@ error: generic parameters with a default must be trailing
    |
 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
   --> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:8:21