remove lazy_normalization_consts

This commit is contained in:
Ellen 2021-08-25 13:31:18 +01:00 committed by lcnr
parent fcc2badf9b
commit c0e853f274
16 changed files with 10 additions and 114 deletions

View File

@ -545,9 +545,6 @@ pub fn set(&self, features: &mut Features, span: Span) {
/// Allows capturing variables in scope using format_args!
(active, format_args_capture, "1.46.0", Some(67984), None),
/// Lazily evaluate constants. This allows constants to depend on type parameters.
(incomplete, lazy_normalization_consts, "1.46.0", Some(72219), None),
/// Allows `if let` guard in match arms.
(active, if_let_guard, "1.47.0", Some(51114), None),

View File

@ -307,7 +307,7 @@ pub enum Res<Id = hir::HirId> {
/// We do however allow `Self` in repeat expression even if it is generic to not break code
/// which already works on stable while causing the `const_evaluatable_unchecked` future compat lint.
///
/// FIXME(lazy_normalization_consts): Remove this bodge once that feature is stable.
/// FIXME(generic_const_exprs): Remove this bodge once that feature is stable.
SelfTy(
/// Optionally, the trait associated with this `Self` type.
Option<DefId>,

View File

@ -678,7 +678,7 @@ fn push_outlives(
fn const_equate(&mut self, _a: &'tcx Const<'tcx>, _b: &'tcx Const<'tcx>) {
span_bug!(
self.cause.span(self.infcx.tcx),
"lazy_normalization_consts: unreachable `const_equate`"
"generic_const_exprs: unreachable `const_equate`"
);
}

View File

@ -1421,7 +1421,7 @@ pub fn borrowck_mode(self) -> BorrowckMode {
pub fn lazy_normalization(self) -> bool {
let features = self.features();
// Note: We do not enable lazy normalization for `min_const_generics`.
features.const_generics || features.lazy_normalization_consts
features.const_generics || features.generic_const_exprs
}
#[inline]

View File

@ -1,5 +1,5 @@
#![crate_name = "foo"]
#![feature(lazy_normalization_consts)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
// Checking if `Send` is implemented for `Hasher` requires us to evaluate a `ConstEquate` predicate,

View File

@ -1,10 +0,0 @@
pub const fn sof<T>() -> usize {
10
}
fn test<T>() {
let _: [u8; sof::<T>()];
//~^ ERROR generic parameters may not be used in const operations
}
fn main() {}

View File

@ -1,11 +0,0 @@
error: generic parameters may not be used in const operations
--> $DIR/feature-gate-lazy_normalization_consts.rs:6:23
|
LL | let _: [u8; sof::<T>()];
| ^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: aborting due to previous error

View File

@ -1,16 +0,0 @@
// check-pass
#![feature(lazy_normalization_consts)]
#![allow(incomplete_features)]
pub struct ArpIPv4<'a> {
_s: &'a u8
}
impl<'a> ArpIPv4<'a> {
const LENGTH: usize = 20;
pub fn to_buffer() -> [u8; Self::LENGTH] {
unimplemented!()
}
}
fn main() {}

View File

@ -1,17 +0,0 @@
#![feature(lazy_normalization_consts)]
//~^ WARN the feature `lazy_normalization_consts` is incomplete
trait ArraySizeTrait {
const SIZE: usize = 0;
}
impl<T: ?Sized> ArraySizeTrait for T {
const SIZE: usize = 1;
}
struct SomeArray<T: ArraySizeTrait> {
array: [u8; T::SIZE],
//~^ ERROR constant expression depends on a generic parameter
phantom: std::marker::PhantomData<T>,
}
fn main() {}

View File

@ -1,19 +0,0 @@
warning: the feature `lazy_normalization_consts` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-57739.rs:1:12
|
LL | #![feature(lazy_normalization_consts)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #72219 <https://github.com/rust-lang/rust/issues/72219> for more information
error: constant expression depends on a generic parameter
--> $DIR/issue-57739.rs:12:12
|
LL | array: [u8; T::SIZE],
| ^^^^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: aborting due to previous error; 1 warning emitted

View File

@ -1,16 +0,0 @@
// check-pass
#![feature(lazy_normalization_consts)]
#![allow(incomplete_features)]
pub struct X<P, Q>(P, Q);
pub struct L<T: ?Sized>(T);
impl<T: ?Sized> L<T> {
const S: usize = 1;
}
impl<T> X<T, [u8; L::<T>::S]> {}
//~^ WARN cannot use constants which depend on generic parameters
//~| WARN this was previously accepted by the compiler but is being phased out
fn main() {}

View File

@ -1,12 +0,0 @@
warning: cannot use constants which depend on generic parameters in types
--> $DIR/issue-73980.rs:12:9
|
LL | impl<T> X<T, [u8; L::<T>::S]> {}
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(const_evaluatable_unchecked)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #76200 <https://github.com/rust-lang/rust/issues/76200>
warning: 1 warning emitted

View File

@ -1,8 +1,8 @@
// build-fail
// compile-flags:-Zpolymorphize=on
#![crate_type = "lib"]
#![feature(lazy_normalization_consts, rustc_attrs)]
//~^ WARN the feature `lazy_normalization_consts` is incomplete
#![feature(generic_const_exprs, rustc_attrs)]
//~^ WARN the feature `generic_const_exprs` is incomplete
#[rustc_polymorphize_error]
fn test<T>() {

View File

@ -1,11 +1,11 @@
warning: the feature `lazy_normalization_consts` is incomplete and may not be safe to use and/or cause compiler crashes
warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/promoted-function-2.rs:4:12
|
LL | #![feature(lazy_normalization_consts, rustc_attrs)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
LL | #![feature(generic_const_exprs, rustc_attrs)]
| ^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #72219 <https://github.com/rust-lang/rust/issues/72219> for more information
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
error: item has unused generic parameters
--> $DIR/promoted-function-2.rs:8:4