about summary refs log tree commit diff
path: root/compiler/rustc_error_codes/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-08-30 22:21:01 +0000
committerbors <bors@rust-lang.org>2021-08-30 22:21:01 +0000
commit6f388bb369ddb6fb64e547009e031598425f773c (patch)
treea8be664d361c23e350e4f7029c46cfd94e4bf96a /compiler/rustc_error_codes/src
parent5d6804469d80aaf26f98090ae016af45e267f58f (diff)
parent87e781799a160129169b838e900aaef8ecb3a9dd (diff)
downloadrust-6f388bb369ddb6fb64e547009e031598425f773c.tar.gz
rust-6f388bb369ddb6fb64e547009e031598425f773c.zip
Auto merge of #88369 - lcnr:cec-rename, r=oli-obk
update const generics feature gates

**tl;dr: split const generics into three features: `adt_const_params`, `const_generics_defaults` and `generic_const_exprs`**

continuing the work of `@BoxyUwU` in #88324, this PR
- renames `feature(const_evaluatable_checked)` to `feature(generic_const_exprs)` which now doesn't need any other feature gate to work. Previously `feature(const_evaluatable_checked)` was only useful in combination with `feature(const_generics)`.
- completely removes `feature(lazy_normalization_consts)`. This feature only supplied the parents generics to anonymous constants, which is pretty useless as generic anon consts are only allowed with `feature(generic_const_exprs)` anyways.
- moves the ability to use additional const param types from `feature(const_generics)` into `feature(adt_const_params)`. As `feature(const_generics)` is now mostly useless without `feature(generic_const_exprs)` we also remove that feature flag.
- updates tests, removing duplicates and unnecessary revisions in some cases and also deletes all unused `*.stderr` files.

I not also remove the ordering restriction for const and type parameters if any of the three const generics features is active.
This ordering restriction feels like the only "real" use of the current `feature(const_generics)` right now so this change isn't a perfect solution, but as I intend to stabilize the ordering - and `feature(const_generics_defaults)` -  in the very near future, I think this is acceptable for now.

---

cc `@rust-lang/project-const-generics` about the new feature names and this change in general.

I don't think we need any external approval for this change but I do intend to publish an update to the const generics tracking issue the day this PR lands, so I don't want this merged yet.

Apologies to whoever ends up reviewing this PR :sweat_smile: :heart:

r? rust-lang/project-const-generics
Diffstat (limited to 'compiler/rustc_error_codes/src')
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0671.md2
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0741.md4
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0770.md1
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0771.md4
4 files changed, 4 insertions, 7 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0671.md b/compiler/rustc_error_codes/src/error_codes/E0671.md
index a993ce826a7..d4dbfb7a5d8 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0671.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0671.md
@@ -4,8 +4,6 @@ Const parameters cannot depend on type parameters.
 The following is therefore invalid:
 
 ```compile_fail,E0770
-#![feature(const_generics)]
-
 fn const_id<T, const N: T>() -> T { // error
     N
 }
diff --git a/compiler/rustc_error_codes/src/error_codes/E0741.md b/compiler/rustc_error_codes/src/error_codes/E0741.md
index 91379bfe05c..70d963cd41f 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0741.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0741.md
@@ -3,7 +3,7 @@ A non-structural-match type was used as the type of a const generic parameter.
 Erroneous code example:
 
 ```compile_fail,E0741
-#![feature(const_generics)]
+#![feature(adt_const_params)]
 
 struct A;
 
@@ -16,7 +16,7 @@ may be used as the types of const generic parameters.
 To fix the previous code example, we derive `PartialEq` and `Eq`:
 
 ```
-#![feature(const_generics)]
+#![feature(adt_const_params)]
 
 #[derive(PartialEq, Eq)] // We derive both traits here.
 struct A;
diff --git a/compiler/rustc_error_codes/src/error_codes/E0770.md b/compiler/rustc_error_codes/src/error_codes/E0770.md
index b39163a9de3..cd8fc481bf0 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0770.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0770.md
@@ -3,7 +3,6 @@ The type of a const parameter references other generic parameters.
 Erroneous code example:
 
 ```compile_fail,E0770
-#![feature(const_generics)]
 fn foo<T, const N: T>() {} // error!
 ```
 
diff --git a/compiler/rustc_error_codes/src/error_codes/E0771.md b/compiler/rustc_error_codes/src/error_codes/E0771.md
index 824a955f6b3..a2a1a20f230 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0771.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0771.md
@@ -4,7 +4,7 @@ allowed.
 Erroneous code example:
 
 ```compile_fail,E0771
-#![feature(const_generics)]
+#![feature(adt_const_params)]
 
 fn function_with_str<'a, const STRING: &'a str>() {} // error!
 ```
@@ -13,7 +13,7 @@ To fix this issue, the lifetime in the const generic need to be changed to
 `'static`:
 
 ```
-#![feature(const_generics)]
+#![feature(adt_const_params)]
 
 fn function_with_str<const STRING: &'static str>() {} // ok!
 ```