rename const_evaluatable_checked to generic_const_exprs

This commit is contained in:
Ellen 2021-08-25 10:21:39 +01:00 committed by lcnr
parent dbb0fe9d80
commit fcc2badf9b
146 changed files with 178 additions and 213 deletions

View File

@ -551,9 +551,6 @@ declare_features! (
/// Allows `if let` guard in match arms.
(active, if_let_guard, "1.47.0", Some(51114), None),
/// Allows non-trivial generic constants which have to be manually propagated upwards.
(incomplete, const_evaluatable_checked, "1.48.0", Some(76560), None),
/// Allows basic arithmetic on floating point types in a `const fn`.
(active, const_fn_floating_point_arithmetic, "1.48.0", Some(57241), None),
@ -679,6 +676,9 @@ declare_features! (
/// Allows using doc(primitive) without a future-incompat warning
(active, doc_primitive, "1.56.0", Some(88070), None),
/// Allows non-trivial generic constants which have to have wfness manually propagated to callers
(incomplete, generic_const_exprs, "1.56.0", Some(76560), None),
// -------------------------------------------------------------------------
// feature-group-end: actual feature gates
// -------------------------------------------------------------------------

View File

@ -128,9 +128,13 @@ declare_features! (
Some("Removed in favor of `~const` bound in #![feature(const_trait_impl)]")),
/// Allows `#[no_debug]`.
(removed, no_debug, "1.43.0", Some(29721), None, Some("removed due to lack of demand")),
/// Lazily evaluate constants. This allows constants to depend on type parameters.
(removed, lazy_normalization_consts, "1.46.0", Some(72219), None, Some("superseded by `generic_const_exprs`")),
/// Allows comparing raw pointers during const eval.
(removed, const_compare_raw_pointers, "1.46.0", Some(53020), None,
Some("cannot be allowed in const eval in any meaningful way")),
/// Allows non-trivial generic constants which have to be manually propagated upwards.
(removed, const_evaluatable_checked, "1.48.0", Some(76560), None, Some("renamed to `generic_const_exprs`")),
/// Allows using the `#[link_args]` attribute.
(removed, link_args, "1.53.0", Some(29596), None,
Some("removed in favor of using `-C link-arg=ARG` on command line, \

View File

@ -577,13 +577,13 @@ pub fn super_relate_consts<R: TypeRelation<'tcx>>(
}
(ty::ConstKind::Unevaluated(au), ty::ConstKind::Unevaluated(bu))
if tcx.features().const_evaluatable_checked =>
if tcx.features().generic_const_exprs =>
{
tcx.try_unify_abstract_consts((au.shrink(), bu.shrink()))
}
// While this is slightly incorrect, it shouldn't matter for `min_const_generics`
// and is the better alternative to waiting until `const_evaluatable_checked` can
// and is the better alternative to waiting until `generic_const_exprs` can
// be stabilized.
(ty::ConstKind::Unevaluated(au), ty::ConstKind::Unevaluated(bu))
if au.def == bu.def && au.promoted == bu.promoted =>

View File

@ -136,7 +136,7 @@ where
}
ty::PredicateKind::RegionOutlives(..) => ControlFlow::CONTINUE,
ty::PredicateKind::ConstEvaluatable(uv)
if self.def_id_visitor.tcx().features().const_evaluatable_checked =>
if self.def_id_visitor.tcx().features().generic_const_exprs =>
{
let tcx = self.def_id_visitor.tcx();
if let Ok(Some(ct)) = AbstractConst::new(tcx, uv) {
@ -1809,7 +1809,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'tcx> {
self.visit(self.tcx.type_of(param.def_id));
}
}
// FIXME(const_evaluatable_checked): May want to look inside const here
// FIXME(generic_const_exprs): May want to look inside const here
GenericParamDefKind::Const { .. } => {
self.visit(self.tcx.type_of(param.def_id));
}

View File

@ -506,8 +506,8 @@ impl<'a> Resolver<'a> {
if self.session.is_nightly_build() {
err.help(
"use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` \
to allow generic const expressions"
"use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` \
to allow generic const expressions",
);
}

View File

@ -2734,9 +2734,7 @@ impl<'a> Resolver<'a> {
ConstantItemRibKind(trivial, _) => {
let features = self.session.features_untracked();
// HACK(min_const_generics): We currently only allow `N` or `{ N }`.
if !(trivial
|| features.const_generics
|| features.lazy_normalization_consts)
if !(trivial || features.const_generics || features.generic_const_exprs)
{
// HACK(min_const_generics): If we encounter `Self` in an anonymous constant
// we can't easily tell if it's generic at this stage, so we instead remember
@ -2809,9 +2807,7 @@ impl<'a> Resolver<'a> {
ConstantItemRibKind(trivial, _) => {
let features = self.session.features_untracked();
// HACK(min_const_generics): We currently only allow `N` or `{ N }`.
if !(trivial
|| features.const_generics
|| features.lazy_normalization_consts)
if !(trivial || features.const_generics || features.generic_const_exprs)
{
if record_used {
self.report_error(

View File

@ -662,6 +662,7 @@ symbols! {
generators,
generic_arg_infer,
generic_associated_types,
generic_const_exprs,
generic_param_attrs,
get_context,
global_allocator,

View File

@ -34,7 +34,7 @@ pub fn is_const_evaluatable<'cx, 'tcx>(
span: Span,
) -> Result<(), NotConstEvaluatable> {
debug!("is_const_evaluatable({:?})", uv);
if infcx.tcx.features().const_evaluatable_checked {
if infcx.tcx.features().generic_const_exprs {
let tcx = infcx.tcx;
match AbstractConst::new(tcx, uv)? {
// We are looking at a generic abstract constant.
@ -537,9 +537,9 @@ pub(super) fn mir_abstract_const<'tcx>(
tcx: TyCtxt<'tcx>,
def: ty::WithOptConstParam<LocalDefId>,
) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
if tcx.features().const_evaluatable_checked {
if tcx.features().generic_const_exprs {
match tcx.def_kind(def.did) {
// FIXME(const_evaluatable_checked): We currently only do this for anonymous constants,
// FIXME(generic_const_exprs): We currently only do this for anonymous constants,
// meaning that we do not look into associated constants. I(@lcnr) am not yet sure whether
// we want to look into them or treat them as opaque projections.
//
@ -568,7 +568,7 @@ pub(super) fn try_unify_abstract_consts<'tcx>(
Ok(false)
})()
.unwrap_or_else(|ErrorReported| true)
// FIXME(const_evaluatable_checked): We should instead have this
// FIXME(generic_const_exprs): We should instead have this
// method return the resulting `ty::Const` and return `ConstKind::Error`
// on `ErrorReported`.
}
@ -656,13 +656,13 @@ pub(super) fn try_unify<'tcx>(
// branch should only be taking when dealing with associated constants, at
// which point directly comparing them seems like the desired behavior.
//
// FIXME(const_evaluatable_checked): This isn't actually the case.
// FIXME(generic_const_exprs): This isn't actually the case.
// We also take this branch for concrete anonymous constants and
// expand generic anonymous constants with concrete substs.
(ty::ConstKind::Unevaluated(a_uv), ty::ConstKind::Unevaluated(b_uv)) => {
a_uv == b_uv
}
// FIXME(const_evaluatable_checked): We may want to either actually try
// FIXME(generic_const_exprs): We may want to either actually try
// to evaluate `a_ct` and `b_ct` if they are are fully concrete or something like
// this, for now we just return false here.
_ => false,

View File

@ -794,7 +794,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
)
}
SelectionError::NotConstEvaluatable(NotConstEvaluatable::MentionsParam) => {
if !self.tcx.features().const_evaluatable_checked {
if !self.tcx.features().generic_const_exprs {
let mut err = self.tcx.sess.struct_span_err(
span,
"constant expression depends on a generic parameter",
@ -803,7 +803,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
// issue. However, this is currently not actually possible
// (see https://github.com/rust-lang/rust/issues/66962#issuecomment-575907083).
//
// Note that with `feature(const_evaluatable_checked)` this case should not
// Note that with `feature(generic_const_exprs)` this case should not
// be reachable.
err.note("this may fail depending on what value the parameter takes");
err.emit();

View File

@ -572,7 +572,7 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
ty::PredicateKind::ConstEquate(c1, c2) => {
debug!(?c1, ?c2, "equating consts");
let tcx = self.selcx.tcx();
if tcx.features().const_evaluatable_checked {
if tcx.features().generic_const_exprs {
// FIXME: we probably should only try to unify abstract constants
// if the constants depend on generic parameters.
//

View File

@ -855,7 +855,7 @@ fn contains_illegal_self_type_reference<'tcx, T: TypeFoldable<'tcx>>(
fn visit_predicate(&mut self, pred: ty::Predicate<'tcx>) -> ControlFlow<Self::BreakTy> {
if let ty::PredicateKind::ConstEvaluatable(ct) = pred.kind().skip_binder() {
// FIXME(const_evaluatable_checked): We should probably deduplicate the logic for
// FIXME(generic_const_exprs): We should probably deduplicate the logic for
// `AbstractConst`s here, it might make sense to change `ConstEvaluatable` to
// take a `ty::Const` instead.
use rustc_middle::mir::abstract_const::Node;

View File

@ -619,7 +619,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
ty::PredicateKind::ConstEquate(c1, c2) => {
debug!(?c1, ?c2, "evaluate_predicate_recursively: equating consts");
if self.tcx().features().const_evaluatable_checked {
if self.tcx().features().generic_const_exprs {
// FIXME: we probably should only try to unify abstract constants
// if the constants depend on generic parameters.
//

View File

@ -2300,7 +2300,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
}
}
if tcx.features().const_evaluatable_checked {
if tcx.features().generic_const_exprs {
predicates.extend(const_evaluatable_predicates_of(tcx, def_id.expect_local()));
}

View File

@ -1,5 +1,5 @@
// revisions: cfail
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
// regression test for #77650
fn c<T, const N: std::num::NonZeroUsize>()

View File

@ -1,5 +1,5 @@
// revisions: cfail
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
// regression test for #77650
struct C<T, const N: core::num::NonZeroUsize>([T; N.get()])

View File

@ -1,5 +1,5 @@
// revisions: cfail
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
// regression test for #79251
struct Node<const D: usize>

View File

@ -1,5 +1,5 @@
// revisions: cfail
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
// regression test for #79251
#[derive(Debug)]

View File

@ -1,5 +1,5 @@
// revisions: cfail
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features, unused_braces)]
trait Delegates<T> {}

View File

@ -1,5 +1,5 @@
// revisions: rpass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
struct Z;

View File

@ -1,5 +1,5 @@
// revisions: rpass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
use std::{convert::TryFrom, num::NonZeroUsize};

View File

@ -1,5 +1,5 @@
// revisions: rpass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
pub trait IsTrue {}
pub trait IsFalse {}

View File

@ -1,5 +1,5 @@
// revisions: rpass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
pub struct Ref<'a, const NUM: usize>(&'a i32);

View File

@ -1,6 +1,6 @@
// revisions: cfail
#![allow(incomplete_features)]
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
pub struct Ref<'a>(&'a i32);

View File

@ -1,5 +1,5 @@
// revisions: rpass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
fn test<const SIZE: usize>() {}

View File

@ -1,5 +1,5 @@
// revisions: rpass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
struct Foo;

View File

@ -1,5 +1,5 @@
// revisions: cfail
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features, unused_braces)]
struct Buffer<T, const S: usize>

View File

@ -1,5 +1,5 @@
#![crate_name = "foo"]
#![feature(const_evaluatable_checked, const_generics)]
#![feature(generic_const_exprs, const_generics)]
#![allow(incomplete_features)]
// make sure that `ConstEvaluatable` predicates dont cause rustdoc to ICE #77647
// @has foo/struct.Ice.html '//pre[@class="rust struct"]' \

View File

@ -5,7 +5,7 @@ LL | let _array: [u32; <A as Foo>::Y];
| ^ cannot perform const operation using `A`
|
= note: type parameters may not be used in const expressions
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic 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

@ -5,7 +5,7 @@ LL | links: [u32; A::LINKS], // Shouldn't suggest bounds already there.
| ^^^^^^^^ cannot perform const operation using `A`
|
= note: type parameters may not be used in const expressions
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic 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

@ -5,7 +5,7 @@ LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]);
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: generic parameters may not be used in const operations
--> $DIR/array-size-in-generic-struct-param.rs:19:15
@ -14,7 +14,7 @@ LL | arr: [u8; CFG.arr_size],
| ^^^ cannot perform const operation using `CFG`
|
= help: const parameters may only be used as standalone arguments, i.e. `CFG`
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: `Config` is forbidden as the type of a const generic parameter
--> $DIR/array-size-in-generic-struct-param.rs:17:21

View File

@ -1,4 +1,4 @@
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
// library portion of regression test for #87674

View File

@ -1,4 +1,4 @@
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
// library portion of testing that `impl Trait<{ expr }>` doesnt

View File

@ -1,5 +1,5 @@
// run-pass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
// This tests that the `conservative_is_privately_uninhabited` fn doesn't cause

View File

@ -1,5 +1,5 @@
// run-pass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
// This tests that the `conservative_is_privately_uninhabited` fn doesn't cause

View File

@ -5,7 +5,7 @@ LL | let _: [u8; foo::<T>()];
| ^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: generic parameters may not be used in const operations
--> $DIR/const-arg-in-const-arg.rs:14:23
@ -14,7 +14,7 @@ LL | let _: [u8; bar::<N>()];
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: generic parameters may not be used in const operations
--> $DIR/const-arg-in-const-arg.rs:24:23
@ -23,7 +23,7 @@ LL | let _ = [0; bar::<N>()];
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: generic parameters may not be used in const operations
--> $DIR/const-arg-in-const-arg.rs:29:24
@ -32,7 +32,7 @@ LL | let _: Foo<{ foo::<T>() }>;
| ^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: generic parameters may not be used in const operations
--> $DIR/const-arg-in-const-arg.rs:30:24
@ -41,7 +41,7 @@ LL | let _: Foo<{ bar::<N>() }>;
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: generic parameters may not be used in const operations
--> $DIR/const-arg-in-const-arg.rs:35:27
@ -50,7 +50,7 @@ LL | let _ = Foo::<{ foo::<T>() }>;
| ^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: generic parameters may not be used in const operations
--> $DIR/const-arg-in-const-arg.rs:36:27
@ -59,7 +59,7 @@ LL | let _ = Foo::<{ bar::<N>() }>;
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error[E0658]: a non-static lifetime is not allowed in a `const`
--> $DIR/const-arg-in-const-arg.rs:15:23

View File

@ -5,7 +5,7 @@ LL | pad: [u8; is_zst::<T>()],
| ^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/const-argument-if-length.rs:16:12

View File

@ -1,20 +0,0 @@
error: generic parameters may not be used in const operations
--> $DIR/simple.rs:7:53
|
LL | fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default {
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
error: generic parameters may not be used in const operations
--> $DIR/simple.rs:7:35
|
LL | fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default {
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
error: aborting due to 2 previous errors

View File

@ -1,16 +0,0 @@
// [full] run-pass
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![feature(const_evaluatable_checked)]
#![allow(incomplete_features)]
fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default {
//[min]~^ ERROR generic parameters
//[min]~| ERROR generic parameters
Default::default()
}
fn main() {
let x = test::<33>();
assert_eq!(x, [0; 32]);
}

View File

@ -1,4 +1,4 @@
#![feature(const_generics, const_evaluatable_checked, const_generics_defaults)]
#![feature(const_generics, generic_const_exprs, const_generics_defaults)]
#![allow(incomplete_features)]
struct Foo<const N: usize, const M: usize = { N + 1 }>;

View File

@ -1,4 +1,4 @@
#![feature(const_generics, const_evaluatable_checked, const_generics_defaults)]
#![feature(const_generics, generic_const_exprs, const_generics_defaults)]
#![allow(incomplete_features)]
struct Foo<const N: usize, const M: usize = { N + 1 }>;

View File

@ -1,4 +1,4 @@
#![feature(const_evaluatable_checked, const_generics, const_generics_defaults)]
#![feature(generic_const_exprs, const_generics, const_generics_defaults)]
#![allow(incomplete_features)]
pub struct Foo<const N: usize, const M: usize = { N + 1 }>;

View File

@ -5,7 +5,7 @@ LL | struct Foo<const N: usize, const M: usize = { N + 1 }>;
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: generic parameters may not be used in const operations
--> $DIR/complex-generic-default-expr.rs:10:62
@ -14,7 +14,7 @@ LL | struct Bar<T, const TYPE_SIZE: usize = { std::mem::size_of::<T>() }>(T);
| ^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: aborting due to 2 previous errors

View File

@ -1,4 +1,4 @@
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
// This tests that during error handling for the "trait not implemented" error

View File

@ -5,7 +5,7 @@ LL | fn bar<const N: usize>() -> [u32; foo(N)] {
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: generic parameters may not be used in const operations
--> $DIR/generic-function-call-in-array-length.rs:11:13
@ -14,7 +14,7 @@ LL | [0; foo(N)]
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: aborting due to 2 previous errors

View File

@ -5,7 +5,7 @@ LL | fn foo<const A: usize, const B: usize>(bar: [usize; A + B]) {}
| ^ cannot perform const operation using `A`
|
= help: const parameters may only be used as standalone arguments, i.e. `A`
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: generic parameters may not be used in const operations
--> $DIR/generic-sum-in-array-length.rs:6:57
@ -14,7 +14,7 @@ LL | fn foo<const A: usize, const B: usize>(bar: [usize; A + B]) {}
| ^ cannot perform const operation using `B`
|
= help: const parameters may only be used as standalone arguments, i.e. `B`
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: aborting due to 2 previous errors

View File

@ -1,5 +1,5 @@
// check-pass
#![feature(const_evaluatable_checked, const_generics)]
#![feature(generic_const_exprs, const_generics)]
#![allow(incomplete_features)]
struct Foo<const N: u8>([u8; N as usize])

View File

@ -1,4 +1,4 @@
#![feature(const_evaluatable_checked, const_generics)]
#![feature(generic_const_exprs, const_generics)]
#![allow(incomplete_features)]
struct Evaluatable<const N: u128> {}

View File

@ -1,4 +1,4 @@
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
trait Trait {}

View File

@ -1,5 +1,5 @@
// check-pass
#![feature(const_evaluatable_checked, const_generics)]
#![feature(generic_const_exprs, const_generics)]
#![allow(incomplete_features)]
trait Trait {}

View File

@ -1,5 +1,5 @@
// run-pass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
pub trait BlockCipher {

View File

@ -1,4 +1,4 @@
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
pub fn test1<T>() -> [u8; std::mem::size_of::<T>() - 1]

View File

@ -1,4 +1,4 @@
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
fn test<const N: usize>() -> [u8; N + (|| 42)()] {}
//~^ ERROR overly complex generic constant

View File

@ -1,6 +1,6 @@
// aux-build:const_evaluatable_lib.rs
// run-pass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
extern crate const_evaluatable_lib;

View File

@ -1,5 +1,5 @@
// aux-build:const_evaluatable_lib.rs
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
extern crate const_evaluatable_lib;

View File

@ -1,4 +1,4 @@
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
use std::mem::size_of;

View File

@ -1,5 +1,5 @@
// run-pass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
fn with_bound<const N: usize>() where [u8; N / 2]: Sized {

View File

@ -1,6 +1,6 @@
// run-pass
#![feature(const_generics)]
#![feature(const_evaluatable_checked)]
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
// This test is a repro for #82279. It checks that we don't error

View File

@ -1,5 +1,5 @@
//check-pass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
struct Foo<const N: usize>

View File

@ -1,7 +1,7 @@
// run-pass
// Test that we use the elaborated predicates from traits
// to satisfy const evaluatable predicates.
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
use std::mem::size_of;

View File

@ -1,5 +1,5 @@
#![crate_type = "lib"]
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
pub struct Const<const U: u8>;

View File

@ -4,7 +4,7 @@
// only contain generic parameters. This is incorrect as trying to unify `N > 1` with `M > 1`
// should fail.
#![allow(incomplete_features)]
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
enum Assert<const COND: bool> {}
trait IsTrue {}

View File

@ -1,5 +1,5 @@
error: constant expression depends on a generic parameter
--> $DIR/feature-gate-const_evaluatable_checked.rs:8:30
--> $DIR/feature-gate-generic_const_exprs.rs:8:30
|
LL | fn test<const N: usize>() -> Arr<N> where Arr<N>: Default {
| ^^^^^^

View File

@ -1,11 +1,11 @@
error: generic parameters may not be used in const operations
--> $DIR/feature-gate-const_evaluatable_checked.rs:5:33
--> $DIR/feature-gate-generic_const_exprs.rs:5:33
|
LL | type Arr<const N: usize> = [u8; N - 1];
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic 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,5 +1,5 @@
// run-pass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
const fn test_me<T>(a: usize, b: usize) -> usize {

View File

@ -1,4 +1,4 @@
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
fn test<const N: usize>() -> [u8; N - 1] {

View File

@ -1,5 +1,5 @@
// run-pass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
struct Foo<const B: bool>;

View File

@ -1,5 +1,5 @@
// check-pass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
use std::mem::size_of;

View File

@ -1,5 +1,5 @@
// run-pass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
use std::{mem, ptr};

View File

@ -1,5 +1,5 @@
// run-pass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
struct Foo<const B: bool>;

View File

@ -1,4 +1,4 @@
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
// We do not yet want to support let-bindings in abstract consts,

View File

@ -1,5 +1,5 @@
// run-pass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
fn callee<const M2: usize>() -> usize

View File

@ -1,5 +1,5 @@
// run-pass
#![feature(const_evaluatable_checked, const_generics)]
#![feature(generic_const_exprs, const_generics)]
#![allow(incomplete_features)]
struct Generic<const K: u64>;

View File

@ -1,5 +1,5 @@
// run-pass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
fn zero_init<const N: usize>() -> Substs1<N>

View File

@ -1,5 +1,5 @@
// run-pass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features, unused_parens, unused_braces)]
fn zero_init<const N: usize>() -> Substs1<{ (N) }>

View File

@ -1,4 +1,4 @@
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]

View File

@ -1,4 +1,4 @@
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
#![deny(where_clauses_object_safety)]

View File

@ -1,4 +1,4 @@
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
trait Foo<const N: usize> {
@ -16,7 +16,7 @@ fn use_dyn<const N: usize>(v: &dyn Foo<N>) where [u8; N + 1]: Sized {
}
fn main() {
// FIXME(const_evaluatable_checked): Improve the error message here.
// FIXME(generic_const_exprs): Improve the error message here.
use_dyn(&());
//~^ ERROR type annotations needed
}

View File

@ -1,5 +1,5 @@
// run-pass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
trait Foo<const N: usize> {

View File

@ -5,7 +5,7 @@ LL | type Arr<const N: usize> = [u8; N - 1];
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: generic parameters may not be used in const operations
--> $DIR/simple_fail.rs:10:48
@ -14,7 +14,7 @@ LL | fn test<const N: usize>() -> Arr<N> where [u8; N - 1]: Sized {
| ^ cannot perform const operation using `N`
|
= help: const parameters may only be used as standalone arguments, i.e. `N`
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: aborting due to 2 previous errors

View File

@ -1,6 +1,6 @@
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, feature(const_evaluatable_checked))]
#![cfg_attr(full, feature(generic_const_exprs))]
#![allow(incomplete_features)]
type Arr<const N: usize> = [u8; N - 1];

View File

@ -1,5 +1,5 @@
// run-pass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
fn make_array<const M: usize>() -> [(); M + 1] {

View File

@ -1,6 +1,6 @@
// check-pass
// Test that we correctly substitute generic arguments for type aliases.
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
type Alias<T, const N: usize> = [T; N + 1];

View File

@ -1,5 +1,5 @@
// run-pass
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
struct Foo<const B: bool>;

View File

@ -1,5 +1,5 @@
// check-pass
#![feature(const_generics, const_evaluatable_checked, const_generics_defaults)]
#![feature(const_generics, generic_const_exprs, const_generics_defaults)]
#![allow(incomplete_features)]
struct Foo<const N: usize, const M: usize = { N + 1 }>;
struct Bar<const N: usize>(Foo<N, 3>);

View File

@ -1,4 +1,4 @@
#![feature(const_generics, const_evaluatable_checked)]
#![feature(const_generics, generic_const_exprs)]
#![allow(incomplete_features)]
fn add<const N: usize>() -> [u8; { N + 1; 5 }] {

View File

@ -5,7 +5,7 @@ LL | T: Trait<{std::intrinsics::type_name::<T>()}>
| ^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
= help: use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` to allow generic const expressions
= help: use `#![feature(const_generics)]` and `#![feature(generic_const_exprs)]` to allow generic const expressions
error: `&'static str` is forbidden as the type of a const generic parameter
--> $DIR/intrinsics-type_name-as-const-argument.rs:9:22

Some files were not shown because too many files have changed in this diff Show More