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 😅 ❤️ r? rust-lang/project-const-generics
This commit is contained in:
commit
6f388bb369
613 changed files with 917 additions and 4514 deletions
|
@ -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`
|
// `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 {
|
||||||
|
|
|
@ -687,7 +687,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) {
|
||||||
gate_all!(trait_alias, "trait aliases are experimental");
|
gate_all!(trait_alias, "trait aliases are experimental");
|
||||||
gate_all!(associated_type_bounds, "associated type bounds are unstable");
|
gate_all!(associated_type_bounds, "associated type bounds are unstable");
|
||||||
gate_all!(crate_visibility_modifier, "`crate` visibility modifier is experimental");
|
gate_all!(crate_visibility_modifier, "`crate` visibility modifier is experimental");
|
||||||
gate_all!(const_generics, "const generics are unstable");
|
|
||||||
gate_all!(decl_macro, "`macro` is experimental");
|
gate_all!(decl_macro, "`macro` is experimental");
|
||||||
gate_all!(box_patterns, "box pattern syntax is experimental");
|
gate_all!(box_patterns, "box pattern syntax is experimental");
|
||||||
gate_all!(exclusive_range_pattern, "exclusive range pattern syntax is experimental");
|
gate_all!(exclusive_range_pattern, "exclusive range pattern syntax is experimental");
|
||||||
|
|
|
@ -4,8 +4,6 @@ Const parameters cannot depend on type parameters.
|
||||||
The following is therefore invalid:
|
The following is therefore invalid:
|
||||||
|
|
||||||
```compile_fail,E0770
|
```compile_fail,E0770
|
||||||
#![feature(const_generics)]
|
|
||||||
|
|
||||||
fn const_id<T, const N: T>() -> T { // error
|
fn const_id<T, const N: T>() -> T { // error
|
||||||
N
|
N
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ A non-structural-match type was used as the type of a const generic parameter.
|
||||||
Erroneous code example:
|
Erroneous code example:
|
||||||
|
|
||||||
```compile_fail,E0741
|
```compile_fail,E0741
|
||||||
#![feature(const_generics)]
|
#![feature(adt_const_params)]
|
||||||
|
|
||||||
struct A;
|
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`:
|
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.
|
#[derive(PartialEq, Eq)] // We derive both traits here.
|
||||||
struct A;
|
struct A;
|
||||||
|
|
|
@ -3,7 +3,6 @@ The type of a const parameter references other generic parameters.
|
||||||
Erroneous code example:
|
Erroneous code example:
|
||||||
|
|
||||||
```compile_fail,E0770
|
```compile_fail,E0770
|
||||||
#![feature(const_generics)]
|
|
||||||
fn foo<T, const N: T>() {} // error!
|
fn foo<T, const N: T>() {} // error!
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ allowed.
|
||||||
Erroneous code example:
|
Erroneous code example:
|
||||||
|
|
||||||
```compile_fail,E0771
|
```compile_fail,E0771
|
||||||
#![feature(const_generics)]
|
#![feature(adt_const_params)]
|
||||||
|
|
||||||
fn function_with_str<'a, const STRING: &'a str>() {} // error!
|
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`:
|
`'static`:
|
||||||
|
|
||||||
```
|
```
|
||||||
#![feature(const_generics)]
|
#![feature(adt_const_params)]
|
||||||
|
|
||||||
fn function_with_str<const STRING: &'static str>() {} // ok!
|
fn function_with_str<const STRING: &'static str>() {} // ok!
|
||||||
```
|
```
|
||||||
|
|
|
@ -273,7 +273,7 @@ declare_features! (
|
||||||
/// Allows patterns with concurrent by-move and by-ref bindings.
|
/// Allows patterns with concurrent by-move and by-ref bindings.
|
||||||
/// For example, you can write `Foo(a, ref b)` where `a` is by-move and `b` is by-ref.
|
/// For example, you can write `Foo(a, ref b)` where `a` is by-move and `b` is by-ref.
|
||||||
(accepted, move_ref_pattern, "1.49.0", Some(68354), None),
|
(accepted, move_ref_pattern, "1.49.0", Some(68354), None),
|
||||||
/// The smallest useful subset of `const_generics`.
|
/// The smallest useful subset of const generics.
|
||||||
(accepted, min_const_generics, "1.51.0", Some(74878), None),
|
(accepted, min_const_generics, "1.51.0", Some(74878), None),
|
||||||
/// The `unsafe_op_in_unsafe_fn` lint (allowed by default): no longer treat an unsafe function as an unsafe block.
|
/// The `unsafe_op_in_unsafe_fn` lint (allowed by default): no longer treat an unsafe function as an unsafe block.
|
||||||
(accepted, unsafe_block_in_unsafe_fn, "1.52.0", Some(71668), None),
|
(accepted, unsafe_block_in_unsafe_fn, "1.52.0", Some(71668), None),
|
||||||
|
|
|
@ -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 || self.const_generics_defaults
|
self.const_generics_defaults || self.generic_const_exprs || self.adt_const_params
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 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
|
||||||
|
@ -453,9 +453,6 @@ declare_features! (
|
||||||
/// Allows using `#[ffi_returns_twice]` on foreign functions.
|
/// Allows using `#[ffi_returns_twice]` on foreign functions.
|
||||||
(active, ffi_returns_twice, "1.34.0", Some(58314), None),
|
(active, ffi_returns_twice, "1.34.0", Some(58314), None),
|
||||||
|
|
||||||
/// Allows const generic types (e.g. `struct Foo<const N: usize>(...);`).
|
|
||||||
(incomplete, const_generics, "1.34.0", Some(44580), None),
|
|
||||||
|
|
||||||
/// Allows using `#[optimize(X)]`.
|
/// Allows using `#[optimize(X)]`.
|
||||||
(active, optimize_attribute, "1.34.0", Some(54882), None),
|
(active, optimize_attribute, "1.34.0", Some(54882), None),
|
||||||
|
|
||||||
|
@ -545,15 +542,9 @@ declare_features! (
|
||||||
/// Allows capturing variables in scope using format_args!
|
/// Allows capturing variables in scope using format_args!
|
||||||
(active, format_args_capture, "1.46.0", Some(67984), None),
|
(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.
|
/// Allows `if let` guard in match arms.
|
||||||
(active, if_let_guard, "1.47.0", Some(51114), None),
|
(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`.
|
/// Allows basic arithmetic on floating point types in a `const fn`.
|
||||||
(active, const_fn_floating_point_arithmetic, "1.48.0", Some(57241), None),
|
(active, const_fn_floating_point_arithmetic, "1.48.0", Some(57241), None),
|
||||||
|
|
||||||
|
@ -679,6 +670,12 @@ declare_features! (
|
||||||
/// Allows using doc(primitive) without a future-incompat warning
|
/// Allows using doc(primitive) without a future-incompat warning
|
||||||
(active, doc_primitive, "1.56.0", Some(88070), None),
|
(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),
|
||||||
|
|
||||||
|
/// Allows additional const parameter types, such as `&'static str` or user defined types
|
||||||
|
(incomplete, adt_const_params, "1.56.0", Some(44580), None),
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
// feature-group-end: actual feature gates
|
// feature-group-end: actual feature gates
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
|
@ -102,6 +102,9 @@ declare_features! (
|
||||||
(removed, extern_in_paths, "1.33.0", Some(55600), None,
|
(removed, extern_in_paths, "1.33.0", Some(55600), None,
|
||||||
Some("subsumed by `::foo::bar` paths")),
|
Some("subsumed by `::foo::bar` paths")),
|
||||||
(removed, quote, "1.33.0", Some(29601), None, None),
|
(removed, quote, "1.33.0", Some(29601), None, None),
|
||||||
|
/// Allows const generic types (e.g. `struct Foo<const N: usize>(...);`).
|
||||||
|
(removed, const_generics, "1.34.0", Some(44580), None,
|
||||||
|
Some("removed in favor of `#![feature(adt_const_params]` and `#![feature(generic_const_exprs)]`")),
|
||||||
/// Allows `[x; N]` where `x` is a constant (RFC 2203).
|
/// Allows `[x; N]` where `x` is a constant (RFC 2203).
|
||||||
(removed, const_in_array_repeat_expressions, "1.37.0", Some(49147), None,
|
(removed, const_in_array_repeat_expressions, "1.37.0", Some(49147), None,
|
||||||
Some("removed due to causing promotable bugs")),
|
Some("removed due to causing promotable bugs")),
|
||||||
|
@ -128,9 +131,13 @@ declare_features! (
|
||||||
Some("Removed in favor of `~const` bound in #![feature(const_trait_impl)]")),
|
Some("Removed in favor of `~const` bound in #![feature(const_trait_impl)]")),
|
||||||
/// Allows `#[no_debug]`.
|
/// Allows `#[no_debug]`.
|
||||||
(removed, no_debug, "1.43.0", Some(29721), None, Some("removed due to lack of demand")),
|
(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.
|
/// Allows comparing raw pointers during const eval.
|
||||||
(removed, const_compare_raw_pointers, "1.46.0", Some(53020), None,
|
(removed, const_compare_raw_pointers, "1.46.0", Some(53020), None,
|
||||||
Some("cannot be allowed in const eval in any meaningful way")),
|
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.
|
/// Allows using the `#[link_args]` attribute.
|
||||||
(removed, link_args, "1.53.0", Some(29596), None,
|
(removed, link_args, "1.53.0", Some(29596), None,
|
||||||
Some("removed in favor of using `-C link-arg=ARG` on command line, \
|
Some("removed in favor of using `-C link-arg=ARG` on command line, \
|
||||||
|
|
|
@ -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
|
/// 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.
|
/// 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(
|
SelfTy(
|
||||||
/// Optionally, the trait associated with this `Self` type.
|
/// Optionally, the trait associated with this `Self` type.
|
||||||
Option<DefId>,
|
Option<DefId>,
|
||||||
|
|
|
@ -678,7 +678,7 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for QueryTypeRelatingDelegate<'_, 'tcx> {
|
||||||
fn const_equate(&mut self, _a: &'tcx Const<'tcx>, _b: &'tcx Const<'tcx>) {
|
fn const_equate(&mut self, _a: &'tcx Const<'tcx>, _b: &'tcx Const<'tcx>) {
|
||||||
span_bug!(
|
span_bug!(
|
||||||
self.cause.span(self.infcx.tcx),
|
self.cause.span(self.infcx.tcx),
|
||||||
"lazy_normalization_consts: unreachable `const_equate`"
|
"generic_const_exprs: unreachable `const_equate`"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> {
|
||||||
/// A good example of this is the following:
|
/// A good example of this is the following:
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// #![feature(const_generics)]
|
/// #![feature(generic_const_exprs)]
|
||||||
///
|
///
|
||||||
/// fn bind<const N: usize>(value: [u8; N]) -> [u8; 3 + 4] {
|
/// fn bind<const N: usize>(value: [u8; N]) -> [u8; 3 + 4] {
|
||||||
/// todo!()
|
/// todo!()
|
||||||
|
|
|
@ -2340,7 +2340,7 @@ declare_lint! {
|
||||||
/// ### Example
|
/// ### Example
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// #![feature(const_generics)]
|
/// #![feature(generic_const_exprs)]
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// {{produces}}
|
/// {{produces}}
|
||||||
|
|
|
@ -1420,8 +1420,8 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn lazy_normalization(self) -> bool {
|
pub fn lazy_normalization(self) -> bool {
|
||||||
let features = self.features();
|
let features = self.features();
|
||||||
// Note: We do not enable lazy normalization for `min_const_generics`.
|
// Note: We only use lazy normalization for generic const expressions.
|
||||||
features.const_generics || features.lazy_normalization_consts
|
features.generic_const_exprs
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
|
@ -577,13 +577,13 @@ pub fn super_relate_consts<R: TypeRelation<'tcx>>(
|
||||||
}
|
}
|
||||||
|
|
||||||
(ty::ConstKind::Unevaluated(au), ty::ConstKind::Unevaluated(bu))
|
(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()))
|
tcx.try_unify_abstract_consts((au.shrink(), bu.shrink()))
|
||||||
}
|
}
|
||||||
|
|
||||||
// While this is slightly incorrect, it shouldn't matter for `min_const_generics`
|
// 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.
|
// be stabilized.
|
||||||
(ty::ConstKind::Unevaluated(au), ty::ConstKind::Unevaluated(bu))
|
(ty::ConstKind::Unevaluated(au), ty::ConstKind::Unevaluated(bu))
|
||||||
if au.def == bu.def && au.promoted == bu.promoted =>
|
if au.def == bu.def && au.promoted == bu.promoted =>
|
||||||
|
|
|
@ -136,7 +136,7 @@ where
|
||||||
}
|
}
|
||||||
ty::PredicateKind::RegionOutlives(..) => ControlFlow::CONTINUE,
|
ty::PredicateKind::RegionOutlives(..) => ControlFlow::CONTINUE,
|
||||||
ty::PredicateKind::ConstEvaluatable(uv)
|
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();
|
let tcx = self.def_id_visitor.tcx();
|
||||||
if let Ok(Some(ct)) = AbstractConst::new(tcx, uv) {
|
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));
|
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 { .. } => {
|
GenericParamDefKind::Const { .. } => {
|
||||||
self.visit(self.tcx.type_of(param.def_id));
|
self.visit(self.tcx.type_of(param.def_id));
|
||||||
}
|
}
|
||||||
|
|
|
@ -506,8 +506,7 @@ impl<'a> Resolver<'a> {
|
||||||
|
|
||||||
if self.session.is_nightly_build() {
|
if self.session.is_nightly_build() {
|
||||||
err.help(
|
err.help(
|
||||||
"use `#![feature(const_generics)]` and `#![feature(const_evaluatable_checked)]` \
|
"use `#![feature(generic_const_exprs)]` to allow generic const expressions",
|
||||||
to allow generic const expressions"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2245,7 +2245,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Non-static lifetimes are prohibited in anonymous constants under `min_const_generics`.
|
/// Non-static lifetimes are prohibited in anonymous constants under `min_const_generics`.
|
||||||
/// This function will emit an error if `const_generics` is not enabled, the body identified by
|
/// This function will emit an error if `generic_const_exprs` is not enabled, the body identified by
|
||||||
/// `body_id` is an anonymous constant and `lifetime_ref` is non-static.
|
/// `body_id` is an anonymous constant and `lifetime_ref` is non-static.
|
||||||
crate fn maybe_emit_forbidden_non_static_lifetime_error(
|
crate fn maybe_emit_forbidden_non_static_lifetime_error(
|
||||||
&self,
|
&self,
|
||||||
|
@ -2264,7 +2264,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
|
||||||
if !self.tcx.lazy_normalization() && is_anon_const && !is_allowed_lifetime {
|
if !self.tcx.lazy_normalization() && is_anon_const && !is_allowed_lifetime {
|
||||||
feature_err(
|
feature_err(
|
||||||
&self.tcx.sess.parse_sess,
|
&self.tcx.sess.parse_sess,
|
||||||
sym::const_generics,
|
sym::generic_const_exprs,
|
||||||
lifetime_ref.span,
|
lifetime_ref.span,
|
||||||
"a non-static lifetime is not allowed in a `const`",
|
"a non-static lifetime is not allowed in a `const`",
|
||||||
)
|
)
|
||||||
|
|
|
@ -2301,7 +2301,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
|
||||||
match *scope {
|
match *scope {
|
||||||
Scope::Body { id, s } => {
|
Scope::Body { id, s } => {
|
||||||
// Non-static lifetimes are prohibited in anonymous constants without
|
// Non-static lifetimes are prohibited in anonymous constants without
|
||||||
// `const_generics`.
|
// `generic_const_exprs`.
|
||||||
self.maybe_emit_forbidden_non_static_lifetime_error(id, lifetime_ref);
|
self.maybe_emit_forbidden_non_static_lifetime_error(id, lifetime_ref);
|
||||||
|
|
||||||
outermost_body = Some(id);
|
outermost_body = Some(id);
|
||||||
|
|
|
@ -2734,10 +2734,7 @@ impl<'a> Resolver<'a> {
|
||||||
ConstantItemRibKind(trivial, _) => {
|
ConstantItemRibKind(trivial, _) => {
|
||||||
let features = self.session.features_untracked();
|
let features = self.session.features_untracked();
|
||||||
// HACK(min_const_generics): We currently only allow `N` or `{ N }`.
|
// HACK(min_const_generics): We currently only allow `N` or `{ N }`.
|
||||||
if !(trivial
|
if !(trivial || features.generic_const_exprs) {
|
||||||
|| features.const_generics
|
|
||||||
|| features.lazy_normalization_consts)
|
|
||||||
{
|
|
||||||
// HACK(min_const_generics): If we encounter `Self` in an anonymous constant
|
// 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
|
// we can't easily tell if it's generic at this stage, so we instead remember
|
||||||
// this and then enforce the self type to be concrete later on.
|
// this and then enforce the self type to be concrete later on.
|
||||||
|
@ -2809,10 +2806,7 @@ impl<'a> Resolver<'a> {
|
||||||
ConstantItemRibKind(trivial, _) => {
|
ConstantItemRibKind(trivial, _) => {
|
||||||
let features = self.session.features_untracked();
|
let features = self.session.features_untracked();
|
||||||
// HACK(min_const_generics): We currently only allow `N` or `{ N }`.
|
// HACK(min_const_generics): We currently only allow `N` or `{ N }`.
|
||||||
if !(trivial
|
if !(trivial || features.generic_const_exprs) {
|
||||||
|| features.const_generics
|
|
||||||
|| features.lazy_normalization_consts)
|
|
||||||
{
|
|
||||||
if record_used {
|
if record_used {
|
||||||
self.report_error(
|
self.report_error(
|
||||||
span,
|
span,
|
||||||
|
|
|
@ -284,6 +284,7 @@ symbols! {
|
||||||
add_assign,
|
add_assign,
|
||||||
add_with_overflow,
|
add_with_overflow,
|
||||||
address,
|
address,
|
||||||
|
adt_const_params,
|
||||||
advanced_slice_patterns,
|
advanced_slice_patterns,
|
||||||
adx_target_feature,
|
adx_target_feature,
|
||||||
alias,
|
alias,
|
||||||
|
@ -662,6 +663,7 @@ symbols! {
|
||||||
generators,
|
generators,
|
||||||
generic_arg_infer,
|
generic_arg_infer,
|
||||||
generic_associated_types,
|
generic_associated_types,
|
||||||
|
generic_const_exprs,
|
||||||
generic_param_attrs,
|
generic_param_attrs,
|
||||||
get_context,
|
get_context,
|
||||||
global_allocator,
|
global_allocator,
|
||||||
|
|
|
@ -34,7 +34,7 @@ pub fn is_const_evaluatable<'cx, 'tcx>(
|
||||||
span: Span,
|
span: Span,
|
||||||
) -> Result<(), NotConstEvaluatable> {
|
) -> Result<(), NotConstEvaluatable> {
|
||||||
debug!("is_const_evaluatable({:?})", uv);
|
debug!("is_const_evaluatable({:?})", uv);
|
||||||
if infcx.tcx.features().const_evaluatable_checked {
|
if infcx.tcx.features().generic_const_exprs {
|
||||||
let tcx = infcx.tcx;
|
let tcx = infcx.tcx;
|
||||||
match AbstractConst::new(tcx, uv)? {
|
match AbstractConst::new(tcx, uv)? {
|
||||||
// We are looking at a generic abstract constant.
|
// We are looking at a generic abstract constant.
|
||||||
|
@ -537,9 +537,9 @@ pub(super) fn mir_abstract_const<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
def: ty::WithOptConstParam<LocalDefId>,
|
def: ty::WithOptConstParam<LocalDefId>,
|
||||||
) -> Result<Option<&'tcx [mir::abstract_const::Node<'tcx>]>, ErrorReported> {
|
) -> 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) {
|
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
|
// 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.
|
// 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)
|
Ok(false)
|
||||||
})()
|
})()
|
||||||
.unwrap_or_else(|ErrorReported| true)
|
.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`
|
// method return the resulting `ty::Const` and return `ConstKind::Error`
|
||||||
// on `ErrorReported`.
|
// on `ErrorReported`.
|
||||||
}
|
}
|
||||||
|
@ -656,13 +656,13 @@ pub(super) fn try_unify<'tcx>(
|
||||||
// branch should only be taking when dealing with associated constants, at
|
// branch should only be taking when dealing with associated constants, at
|
||||||
// which point directly comparing them seems like the desired behavior.
|
// 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
|
// We also take this branch for concrete anonymous constants and
|
||||||
// expand generic anonymous constants with concrete substs.
|
// expand generic anonymous constants with concrete substs.
|
||||||
(ty::ConstKind::Unevaluated(a_uv), ty::ConstKind::Unevaluated(b_uv)) => {
|
(ty::ConstKind::Unevaluated(a_uv), ty::ConstKind::Unevaluated(b_uv)) => {
|
||||||
a_uv == 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
|
// to evaluate `a_ct` and `b_ct` if they are are fully concrete or something like
|
||||||
// this, for now we just return false here.
|
// this, for now we just return false here.
|
||||||
_ => false,
|
_ => false,
|
||||||
|
|
|
@ -794,7 +794,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
SelectionError::NotConstEvaluatable(NotConstEvaluatable::MentionsParam) => {
|
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(
|
let mut err = self.tcx.sess.struct_span_err(
|
||||||
span,
|
span,
|
||||||
"constant expression depends on a generic parameter",
|
"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
|
// issue. However, this is currently not actually possible
|
||||||
// (see https://github.com/rust-lang/rust/issues/66962#issuecomment-575907083).
|
// (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.
|
// be reachable.
|
||||||
err.note("this may fail depending on what value the parameter takes");
|
err.note("this may fail depending on what value the parameter takes");
|
||||||
err.emit();
|
err.emit();
|
||||||
|
|
|
@ -572,7 +572,7 @@ impl<'a, 'b, 'tcx> FulfillProcessor<'a, 'b, 'tcx> {
|
||||||
ty::PredicateKind::ConstEquate(c1, c2) => {
|
ty::PredicateKind::ConstEquate(c1, c2) => {
|
||||||
debug!(?c1, ?c2, "equating consts");
|
debug!(?c1, ?c2, "equating consts");
|
||||||
let tcx = self.selcx.tcx();
|
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
|
// FIXME: we probably should only try to unify abstract constants
|
||||||
// if the constants depend on generic parameters.
|
// if the constants depend on generic parameters.
|
||||||
//
|
//
|
||||||
|
|
|
@ -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> {
|
fn visit_predicate(&mut self, pred: ty::Predicate<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||||
if let ty::PredicateKind::ConstEvaluatable(ct) = pred.kind().skip_binder() {
|
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
|
// `AbstractConst`s here, it might make sense to change `ConstEvaluatable` to
|
||||||
// take a `ty::Const` instead.
|
// take a `ty::Const` instead.
|
||||||
use rustc_middle::mir::abstract_const::Node;
|
use rustc_middle::mir::abstract_const::Node;
|
||||||
|
|
|
@ -619,7 +619,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
ty::PredicateKind::ConstEquate(c1, c2) => {
|
ty::PredicateKind::ConstEquate(c1, c2) => {
|
||||||
debug!(?c1, ?c2, "evaluate_predicate_recursively: equating consts");
|
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
|
// FIXME: we probably should only try to unify abstract constants
|
||||||
// if the constants depend on generic parameters.
|
// if the constants depend on generic parameters.
|
||||||
//
|
//
|
||||||
|
|
|
@ -290,7 +290,7 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {
|
||||||
|
|
||||||
let err_ty_str;
|
let err_ty_str;
|
||||||
let mut is_ptr = true;
|
let mut is_ptr = true;
|
||||||
let err = if tcx.features().const_generics {
|
let err = if tcx.features().adt_const_params {
|
||||||
match ty.peel_refs().kind() {
|
match ty.peel_refs().kind() {
|
||||||
ty::FnPtr(_) => Some("function pointers"),
|
ty::FnPtr(_) => Some("function pointers"),
|
||||||
ty::RawPtr(_) => Some("raw pointers"),
|
ty::RawPtr(_) => Some("raw pointers"),
|
||||||
|
@ -328,7 +328,7 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) {
|
||||||
err.note("the only supported types are integers, `bool` and `char`");
|
err.note("the only supported types are integers, `bool` and `char`");
|
||||||
if tcx.sess.is_nightly_build() {
|
if tcx.sess.is_nightly_build() {
|
||||||
err.help(
|
err.help(
|
||||||
"more complex types are supported with `#![feature(const_generics)]`",
|
"more complex types are supported with `#![feature(adt_const_params)]`",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
err.emit()
|
err.emit()
|
||||||
|
|
|
@ -1489,7 +1489,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::Generics {
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACK(eddyb) this provides the correct generics when
|
// HACK(eddyb) this provides the correct generics when
|
||||||
// `feature(const_generics)` is enabled, so that const expressions
|
// `feature(generic_const_expressions)` is enabled, so that const expressions
|
||||||
// used with const generics, e.g. `Foo<{N+1}>`, can work at all.
|
// used with const generics, e.g. `Foo<{N+1}>`, can work at all.
|
||||||
//
|
//
|
||||||
// Note that we do not supply the parent generics when using
|
// Note that we do not supply the parent generics when using
|
||||||
|
@ -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()));
|
predicates.extend(const_evaluatable_predicates_of(tcx, def_id.expect_local()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,8 +82,8 @@
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
#![feature(omit_gdb_pretty_printer_section)]
|
#![feature(omit_gdb_pretty_printer_section)]
|
||||||
#![omit_gdb_pretty_printer_section]
|
#![omit_gdb_pretty_printer_section]
|
||||||
#![feature(const_generics, generators, generator_trait)]
|
#![feature(adt_const_params, generators, generator_trait)]
|
||||||
#![allow(incomplete_features)] // for const_generics
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
use Mod1::TestTrait2;
|
use Mod1::TestTrait2;
|
||||||
use std::ops::Generator;
|
use std::ops::Generator;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// revisions: cfail
|
// revisions: cfail
|
||||||
#![feature(const_generics, const_evaluatable_checked)]
|
#![feature(generic_const_exprs, adt_const_params)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
// regression test for #77650
|
// regression test for #77650
|
||||||
fn c<T, const N: std::num::NonZeroUsize>()
|
fn c<T, const N: std::num::NonZeroUsize>()
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
error[E0277]: the trait bound `[T; _]: From<()>` is not satisfied
|
|
||||||
--> $DIR/hash-tyvid-regression-1.rs:9:5
|
|
||||||
|
|
|
||||||
LL | <[T; N.get()]>::try_from(())
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `From<()>` is not implemented for `[T; _]`
|
|
||||||
|
|
|
||||||
= note: required because of the requirements on the impl of `Into<[T; _]>` for `()`
|
|
||||||
= note: required because of the requirements on the impl of `TryFrom<()>` for `[T; _]`
|
|
||||||
note: required by `try_from`
|
|
||||||
--> $SRC_DIR/core/src/convert/mod.rs:LL:COL
|
|
||||||
|
|
|
||||||
LL | fn try_from(value: T) -> Result<Self, Self::Error>;
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
|
||||||
--> $DIR/hash-tyvid-regression-1.rs:9:5
|
|
||||||
|
|
|
||||||
LL | <[T; N.get()]>::try_from(())
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found enum `Result`
|
|
||||||
|
|
|
||||||
= note: expected unit type `()`
|
|
||||||
found enum `Result<[T; _], Infallible>`
|
|
||||||
help: consider using a semicolon here
|
|
||||||
|
|
|
||||||
LL | <[T; N.get()]>::try_from(());
|
|
||||||
| +
|
|
||||||
help: try adding a return type
|
|
||||||
|
|
|
||||||
LL | -> Result<[T; _], Infallible> where
|
|
||||||
| +++++++++++++++++++++++++++++
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
|
||||||
|
|
||||||
Some errors have detailed explanations: E0277, E0308.
|
|
||||||
For more information about an error, try `rustc --explain E0277`.
|
|
|
@ -1,5 +1,5 @@
|
||||||
// revisions: cfail
|
// revisions: cfail
|
||||||
#![feature(const_generics, const_evaluatable_checked)]
|
#![feature(generic_const_exprs, adt_const_params, const_generics_defaults)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
// regression test for #77650
|
// regression test for #77650
|
||||||
struct C<T, const N: core::num::NonZeroUsize>([T; N.get()])
|
struct C<T, const N: core::num::NonZeroUsize>([T; N.get()])
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
error[E0277]: can't compare `[B; _]` with `&&[A]`
|
|
||||||
--> $DIR/hash-tyvid-regression-2.rs:12:16
|
|
||||||
|
|
|
||||||
LL | self.0 == other
|
|
||||||
| ^^ no implementation for `[B; _] == &&[A]`
|
|
||||||
|
|
|
||||||
= help: the trait `PartialEq<&&[A]>` is not implemented for `[B; _]`
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0277`.
|
|
|
@ -1,5 +1,5 @@
|
||||||
// revisions: cfail
|
// revisions: cfail
|
||||||
#![feature(const_generics, const_evaluatable_checked)]
|
#![feature(generic_const_exprs)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
// regression test for #79251
|
// regression test for #79251
|
||||||
struct Node<const D: usize>
|
struct Node<const D: usize>
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
error[E0599]: no method named `some_function` found for struct `SmallVec` in the current scope
|
|
||||||
--> $DIR/hash-tyvid-regression-3.rs:17:19
|
|
||||||
|
|
|
||||||
LL | node.keys.some_function();
|
|
||||||
| ^^^^^^^^^^^^^ method not found in `SmallVec<{ D * 2 }>`
|
|
||||||
...
|
|
||||||
LL | struct SmallVec<const D: usize> {}
|
|
||||||
| ------------------------------- method `some_function` not found for this
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0599`.
|
|
|
@ -1,5 +1,5 @@
|
||||||
// revisions: cfail
|
// revisions: cfail
|
||||||
#![feature(const_generics, const_evaluatable_checked)]
|
#![feature(generic_const_exprs)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
// regression test for #79251
|
// regression test for #79251
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
error[E0599]: no method named `push` found for struct `SmallVec` in the current scope
|
|
||||||
--> $DIR/hash-tyvid-regression-4.rs:23:19
|
|
||||||
|
|
|
||||||
LL | node.keys.push(k);
|
|
||||||
| ^^^^ method not found in `SmallVec<_, { D * 2 }>`
|
|
||||||
...
|
|
||||||
LL | struct SmallVec<T, const D: usize> {
|
|
||||||
| ---------------------------------- method `push` not found for this
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0599`.
|
|
|
@ -1,7 +1,5 @@
|
||||||
// revisions:rpass1
|
// revisions:rpass1
|
||||||
|
|
||||||
#![feature(const_generics)]
|
|
||||||
|
|
||||||
struct Struct<T>(T);
|
struct Struct<T>(T);
|
||||||
|
|
||||||
impl<T, const N: usize> Struct<[T; N]> {
|
impl<T, const N: usize> Struct<[T; N]> {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
// revisions:rpass1
|
// revisions:rpass1
|
||||||
|
|
||||||
#![feature(const_generics)]
|
|
||||||
|
|
||||||
struct FakeArray<T, const N: usize>(T);
|
struct FakeArray<T, const N: usize>(T);
|
||||||
|
|
||||||
impl<T, const N: usize> FakeArray<T, N> {
|
impl<T, const N: usize> FakeArray<T, N> {
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
// revisions:cfail1
|
// revisions:cfail1
|
||||||
#![feature(const_generics)]
|
|
||||||
//[cfail1]~^ WARN the feature `const_generics` is incomplete
|
|
||||||
|
|
||||||
struct S<T, const N: usize>([T; N]);
|
struct S<T, const N: usize>([T; N]);
|
||||||
|
|
||||||
fn f<T, const N: usize>(x: T) -> S<T, {N}> { panic!() }
|
fn f<T, const N: usize>(x: T) -> S<T, {N}> { panic!() }
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
// revisions:cfail1
|
// revisions:cfail1
|
||||||
#![feature(const_generics)]
|
|
||||||
//[cfail1]~^ WARN the feature `const_generics` is incomplete
|
|
||||||
|
|
||||||
fn combinator<T, const S: usize>() -> [T; S] {}
|
fn combinator<T, const S: usize>() -> [T; S] {}
|
||||||
//[cfail1]~^ ERROR mismatched types
|
//[cfail1]~^ ERROR mismatched types
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
// revisions:rpass1
|
// revisions:rpass1
|
||||||
#![feature(const_generics)]
|
|
||||||
|
|
||||||
pub struct Foo<T, const N: usize>([T; 0]);
|
pub struct Foo<T, const N: usize>([T; 0]);
|
||||||
|
|
||||||
impl<T, const N: usize> Foo<T, {N}> {
|
impl<T, const N: usize> Foo<T, {N}> {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
// edition:2018
|
// edition:2018
|
||||||
// revisions:rpass1
|
// revisions:rpass1
|
||||||
#![feature(const_generics)]
|
|
||||||
|
// Needed to supply generic arguments to the anon const in `[(); FOO]`.
|
||||||
|
#![feature(generic_const_exprs)]
|
||||||
|
|
||||||
const FOO: usize = 1;
|
const FOO: usize = 1;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// revisions: cfail
|
// revisions: cfail
|
||||||
#![feature(const_generics, const_evaluatable_checked)]
|
#![feature(generic_const_exprs)]
|
||||||
#![allow(incomplete_features, unused_braces)]
|
#![allow(incomplete_features, unused_braces)]
|
||||||
|
|
||||||
trait Delegates<T> {}
|
trait Delegates<T> {}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// revisions: rpass
|
// revisions: rpass
|
||||||
#![feature(const_generics, const_evaluatable_checked)]
|
#![feature(generic_const_exprs)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
struct Z;
|
struct Z;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// revisions: rpass
|
// revisions: rpass
|
||||||
#![feature(const_generics, const_evaluatable_checked)]
|
#![feature(generic_const_exprs, adt_const_params)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
use std::{convert::TryFrom, num::NonZeroUsize};
|
use std::{convert::TryFrom, num::NonZeroUsize};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// revisions: rpass
|
// revisions: rpass
|
||||||
#![feature(const_generics, const_evaluatable_checked)]
|
#![feature(generic_const_exprs)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
pub trait IsTrue {}
|
pub trait IsTrue {}
|
||||||
pub trait IsFalse {}
|
pub trait IsFalse {}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// revisions: rpass
|
// revisions: rpass
|
||||||
#![feature(const_generics, const_evaluatable_checked)]
|
#![feature(generic_const_exprs)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
pub struct Ref<'a, const NUM: usize>(&'a i32);
|
pub struct Ref<'a, const NUM: usize>(&'a i32);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// revisions: cfail
|
// revisions: cfail
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
#![feature(const_generics, const_evaluatable_checked)]
|
#![feature(generic_const_exprs)]
|
||||||
|
|
||||||
pub struct Ref<'a>(&'a i32);
|
pub struct Ref<'a>(&'a i32);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// revisions: rpass
|
// revisions: rpass
|
||||||
#![feature(const_generics, const_evaluatable_checked)]
|
#![feature(generic_const_exprs)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
fn test<const SIZE: usize>() {}
|
fn test<const SIZE: usize>() {}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// revisions: rpass
|
// revisions: rpass
|
||||||
#![feature(const_generics, const_evaluatable_checked)]
|
#![feature(generic_const_exprs)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
struct Foo;
|
struct Foo;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// revisions: cfail
|
// revisions: cfail
|
||||||
#![feature(const_generics, const_evaluatable_checked)]
|
#![feature(generic_const_exprs)]
|
||||||
#![allow(incomplete_features, unused_braces)]
|
#![allow(incomplete_features, unused_braces)]
|
||||||
|
|
||||||
struct Buffer<T, const S: usize>
|
struct Buffer<T, const S: usize>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#![feature(const_generics)]
|
|
||||||
#![crate_name = "foo"]
|
#![crate_name = "foo"]
|
||||||
|
|
||||||
use std::ops::Add;
|
use std::ops::Add;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#![crate_name = "foo"]
|
#![crate_name = "foo"]
|
||||||
#![feature(const_generics)]
|
|
||||||
|
|
||||||
pub trait Array {
|
pub trait Array {
|
||||||
type Item;
|
type Item;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![feature(const_generics)]
|
#![feature(adt_const_params)]
|
||||||
|
|
||||||
#![crate_name = "foo"]
|
#![crate_name = "foo"]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#![crate_name = "foo"]
|
#![crate_name = "foo"]
|
||||||
#![feature(const_evaluatable_checked, const_generics)]
|
#![feature(generic_const_exprs)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
// make sure that `ConstEvaluatable` predicates dont cause rustdoc to ICE #77647
|
// make sure that `ConstEvaluatable` predicates dont cause rustdoc to ICE #77647
|
||||||
// @has foo/struct.Ice.html '//pre[@class="rust struct"]' \
|
// @has foo/struct.Ice.html '//pre[@class="rust struct"]' \
|
|
@ -1,5 +1,5 @@
|
||||||
#![crate_name = "foo"]
|
#![crate_name = "foo"]
|
||||||
#![feature(lazy_normalization_consts)]
|
#![feature(generic_const_exprs)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
// Checking if `Send` is implemented for `Hasher` requires us to evaluate a `ConstEquate` predicate,
|
// Checking if `Send` is implemented for `Hasher` requires us to evaluate a `ConstEquate` predicate,
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
#![feature(const_generics)]
|
|
||||||
//~^ WARN the feature `const_generics` is incomplete
|
|
||||||
|
|
||||||
fn is_123<const N: usize>(x: [u32; N]) -> bool {
|
fn is_123<const N: usize>(x: [u32; N]) -> bool {
|
||||||
match x {
|
match x {
|
||||||
[1, 2] => true, //~ ERROR mismatched types
|
[1, 2] => true, //~ ERROR mismatched types
|
||||||
|
|
|
@ -1,14 +1,5 @@
|
||||||
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
|
|
||||||
--> $DIR/match_arr_unknown_len.rs:1:12
|
|
||||||
|
|
|
||||||
LL | #![feature(const_generics)]
|
|
||||||
| ^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: `#[warn(incomplete_features)]` on by default
|
|
||||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/match_arr_unknown_len.rs:6:9
|
--> $DIR/match_arr_unknown_len.rs:3:9
|
||||||
|
|
|
|
||||||
LL | [1, 2] => true,
|
LL | [1, 2] => true,
|
||||||
| ^^^^^^ expected `2_usize`, found `N`
|
| ^^^^^^ expected `2_usize`, found `N`
|
||||||
|
@ -16,6 +7,6 @@ LL | [1, 2] => true,
|
||||||
= note: expected array `[u32; 2]`
|
= note: expected array `[u32; 2]`
|
||||||
found array `[u32; N]`
|
found array `[u32; N]`
|
||||||
|
|
||||||
error: aborting due to previous error; 1 warning emitted
|
error: aborting due to previous error
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0308`.
|
For more information about this error, try `rustc --explain E0308`.
|
||||||
|
|
|
@ -5,7 +5,7 @@ LL | let _array: [u32; <A as Foo>::Y];
|
||||||
| ^ cannot perform const operation using `A`
|
| ^ cannot perform const operation using `A`
|
||||||
|
|
|
|
||||||
= note: type parameters may not be used in const expressions
|
= 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(generic_const_exprs)]` to allow generic const expressions
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ LL | links: [u32; A::LINKS], // Shouldn't suggest bounds already there.
|
||||||
| ^^^^^^^^ cannot perform const operation using `A`
|
| ^^^^^^^^ cannot perform const operation using `A`
|
||||||
|
|
|
|
||||||
= note: type parameters may not be used in const expressions
|
= 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(generic_const_exprs)]` to allow generic const expressions
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// edition:2018
|
// edition:2018
|
||||||
// revisions: full min
|
// revisions: full min
|
||||||
|
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
#![cfg_attr(full, feature(adt_const_params))]
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
#![cfg_attr(full, allow(incomplete_features))]
|
||||||
|
|
||||||
struct Foo;
|
struct Foo;
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
error[E0158]: const parameters cannot be referenced in patterns
|
|
||||||
--> $DIR/const-param.rs:8:9
|
|
||||||
|
|
|
||||||
LL | N => {}
|
|
||||||
| ^
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0158`.
|
|
|
@ -1,7 +1,4 @@
|
||||||
// Identifier pattern referring to a const generic parameter is an error (issue #68853).
|
// Identifier pattern referring to a const generic parameter is an error (issue #68853).
|
||||||
// revisions: full min
|
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
|
||||||
|
|
||||||
fn check<const N: usize>() {
|
fn check<const N: usize>() {
|
||||||
match 1 {
|
match 1 {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0158]: const parameters cannot be referenced in patterns
|
error[E0158]: const parameters cannot be referenced in patterns
|
||||||
--> $DIR/const-param.rs:8:9
|
--> $DIR/const-param.rs:5:9
|
||||||
|
|
|
|
||||||
LL | N => {}
|
LL | N => {}
|
||||||
| ^
|
| ^
|
|
@ -1,8 +1,4 @@
|
||||||
// check-pass
|
// check-pass
|
||||||
// revisions: full min
|
|
||||||
|
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
|
||||||
|
|
||||||
trait Trait {}
|
trait Trait {}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
error: lifetime parameters must be declared prior to const parameters
|
error: lifetime parameters must be declared prior to const parameters
|
||||||
--> $DIR/argument_order.rs:11:32
|
--> $DIR/argument_order.rs:10:32
|
||||||
|
|
|
|
||||||
LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
|
LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
|
||||||
| -----------------^^-----^^-------------------- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, const N: usize, T, const M: usize, U>`
|
| -----------------^^-----^^-------------------- help: reorder the parameters: lifetimes, then consts and types: `<'a, 'b, const N: usize, T, const M: usize, U>`
|
||||||
|
|
||||||
error[E0747]: lifetime provided when a type was expected
|
error[E0747]: lifetime provided when a type was expected
|
||||||
--> $DIR/argument_order.rs:19:23
|
--> $DIR/argument_order.rs:18:23
|
||||||
|
|
|
|
||||||
LL | let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
|
LL | let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
error: type parameters must be declared prior to const parameters
|
error: type parameters must be declared prior to const parameters
|
||||||
--> $DIR/argument_order.rs:5:28
|
--> $DIR/argument_order.rs:4:28
|
||||||
|
|
|
|
||||||
LL | struct Bad<const N: usize, T> {
|
LL | struct Bad<const N: usize, T> {
|
||||||
| -----------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const N: usize>`
|
| -----------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const N: usize>`
|
||||||
|
|
||||||
error: lifetime parameters must be declared prior to const parameters
|
error: lifetime parameters must be declared prior to const parameters
|
||||||
--> $DIR/argument_order.rs:11:32
|
--> $DIR/argument_order.rs:10:32
|
||||||
|
|
|
|
||||||
LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
|
LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
|
||||||
| -----------------^^-----^^-------------------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T, U, const N: usize, const M: usize>`
|
| -----------------^^-----^^-------------------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T, U, const N: usize, const M: usize>`
|
||||||
|
|
||||||
error: type parameters must be declared prior to const parameters
|
error: type parameters must be declared prior to const parameters
|
||||||
--> $DIR/argument_order.rs:11:36
|
--> $DIR/argument_order.rs:10:36
|
||||||
|
|
|
|
||||||
LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
|
LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> {
|
||||||
| ---------------------^----------------------^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T, U, const N: usize, const M: usize>`
|
| ---------------------^----------------------^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T, U, const N: usize, const M: usize>`
|
||||||
|
|
||||||
error[E0747]: lifetime provided when a type was expected
|
error[E0747]: lifetime provided when a type was expected
|
||||||
--> $DIR/argument_order.rs:19:23
|
--> $DIR/argument_order.rs:18:23
|
||||||
|
|
|
|
||||||
LL | let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
|
LL | let _: AlsoBad<7, 'static, u32, 'static, 17, u16>;
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// revisions: full min
|
// revisions: full min
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
#![cfg_attr(full, feature(const_generics_defaults))]
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
|
||||||
|
|
||||||
struct Bad<const N: usize, T> {
|
struct Bad<const N: usize, T> {
|
||||||
//[min]~^ ERROR type parameters must be declared prior to const parameters
|
//[min]~^ ERROR type parameters must be declared prior to const parameters
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
error: constant expression depends on a generic parameter
|
|
||||||
--> $DIR/array-size-in-generic-struct-param.rs:8:38
|
|
||||||
|
|
|
||||||
LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]);
|
|
||||||
| ^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: this may fail depending on what value the parameter takes
|
|
||||||
|
|
||||||
error: constant expression depends on a generic parameter
|
|
||||||
--> $DIR/array-size-in-generic-struct-param.rs:19:10
|
|
||||||
|
|
|
||||||
LL | arr: [u8; CFG.arr_size],
|
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: this may fail depending on what value the parameter takes
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// revisions: full min
|
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
|
||||||
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
error[E0277]: the trait bound `u16: Bar<N>` is not satisfied
|
|
||||||
--> $DIR/associated-type-bound-fail.rs:13:5
|
|
||||||
|
|
|
||||||
LL | type Assoc = u16;
|
|
||||||
| ^^^^^^^^^^^^^^^^^ the trait `Bar<N>` is not implemented for `u16`
|
|
||||||
|
|
|
||||||
= help: the following implementations were found:
|
|
||||||
<u16 as Bar<3_usize>>
|
|
||||||
note: required by a bound in `Foo::Assoc`
|
|
||||||
--> $DIR/associated-type-bound-fail.rs:8:17
|
|
||||||
|
|
|
||||||
LL | type Assoc: Bar<N>;
|
|
||||||
| ^^^^^^ required by this bound in `Foo::Assoc`
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0277`.
|
|
|
@ -1,7 +1,3 @@
|
||||||
// revisions: full min
|
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
|
||||||
|
|
||||||
trait Bar<const N: usize> {}
|
trait Bar<const N: usize> {}
|
||||||
|
|
||||||
trait Foo<const N: usize> {
|
trait Foo<const N: usize> {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0277]: the trait bound `u16: Bar<N>` is not satisfied
|
error[E0277]: the trait bound `u16: Bar<N>` is not satisfied
|
||||||
--> $DIR/associated-type-bound-fail.rs:13:5
|
--> $DIR/associated-type-bound-fail.rs:9:5
|
||||||
|
|
|
|
||||||
LL | type Assoc = u16;
|
LL | type Assoc = u16;
|
||||||
| ^^^^^^^^^^^^^^^^^ the trait `Bar<N>` is not implemented for `u16`
|
| ^^^^^^^^^^^^^^^^^ the trait `Bar<N>` is not implemented for `u16`
|
||||||
|
@ -7,7 +7,7 @@ LL | type Assoc = u16;
|
||||||
= help: the following implementations were found:
|
= help: the following implementations were found:
|
||||||
<u16 as Bar<3_usize>>
|
<u16 as Bar<3_usize>>
|
||||||
note: required by a bound in `Foo::Assoc`
|
note: required by a bound in `Foo::Assoc`
|
||||||
--> $DIR/associated-type-bound-fail.rs:8:17
|
--> $DIR/associated-type-bound-fail.rs:4:17
|
||||||
|
|
|
|
||||||
LL | type Assoc: Bar<N>;
|
LL | type Assoc: Bar<N>;
|
||||||
| ^^^^^^ required by this bound in `Foo::Assoc`
|
| ^^^^^^ required by this bound in `Foo::Assoc`
|
|
@ -1,8 +1,4 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// revisions: full min
|
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
|
||||||
|
|
||||||
trait Bar<const N: usize> {}
|
trait Bar<const N: usize> {}
|
||||||
|
|
||||||
trait Foo<const N: usize> {
|
trait Foo<const N: usize> {
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
|
||||||
|
|
||||||
pub struct Struct<const N: usize>(pub [u8; N]);
|
pub struct Struct<const N: usize>(pub [u8; N]);
|
||||||
|
|
||||||
pub type Alias = Struct<2>;
|
pub type Alias = Struct<2>;
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
// edition:2018
|
// edition:2018
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
|
||||||
|
|
||||||
pub trait Foo<const N: usize> {}
|
pub trait Foo<const N: usize> {}
|
||||||
struct Local;
|
struct Local;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![feature(const_generics, const_evaluatable_checked)]
|
#![feature(generic_const_exprs)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
// library portion of regression test for #87674
|
// library portion of regression test for #87674
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#![feature(const_generics, const_evaluatable_checked)]
|
#![feature(generic_const_exprs)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
// library portion of testing that `impl Trait<{ expr }>` doesnt
|
// library portion of testing that `impl Trait<{ expr }>` doesnt
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// revisions: full min
|
|
||||||
|
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
|
||||||
|
|
||||||
pub trait Foo {
|
pub trait Foo {
|
||||||
fn foo(&self);
|
fn foo(&self);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// revisions: full min
|
|
||||||
|
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
|
||||||
|
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
// check-pass
|
// check-pass
|
||||||
// revisions: full min
|
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
|
||||||
|
|
||||||
// This test confirms that the types can be inferred correctly for this example with const
|
// This test confirms that the types can be inferred correctly for this example with const
|
||||||
// generics. Previously this would ICE, and more recently error.
|
// generics. Previously this would ICE, and more recently error.
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
error: expressions must be enclosed in braces to be used as const generic arguments
|
|
||||||
--> $DIR/closing-args-token.rs:10:9
|
|
||||||
|
|
|
||||||
LL | S::<5 + 2 >> 7>;
|
|
||||||
| ^^^^^
|
|
||||||
|
|
|
||||||
help: enclose the `const` expression in braces
|
|
||||||
|
|
|
||||||
LL | S::<{ 5 + 2 } >> 7>;
|
|
||||||
| + +
|
|
||||||
|
|
||||||
error: comparison operators cannot be chained
|
|
||||||
--> $DIR/closing-args-token.rs:10:16
|
|
||||||
|
|
|
||||||
LL | S::<5 + 2 >> 7>;
|
|
||||||
| ^ ^
|
|
||||||
|
|
|
||||||
help: split the comparison into two
|
|
||||||
|
|
|
||||||
LL | S::<5 + 2 >> 7 && 7>;
|
|
||||||
| ++++
|
|
||||||
|
|
||||||
error: comparison operators cannot be chained
|
|
||||||
--> $DIR/closing-args-token.rs:16:20
|
|
||||||
|
|
|
||||||
LL | S::<{ 5 + 2 } >> 7>;
|
|
||||||
| ^ ^
|
|
||||||
|
|
|
||||||
help: split the comparison into two
|
|
||||||
|
|
|
||||||
LL | S::<{ 5 + 2 } >> 7 && 7>;
|
|
||||||
| ++++
|
|
||||||
|
|
||||||
error: expected expression, found `;`
|
|
||||||
--> $DIR/closing-args-token.rs:21:16
|
|
||||||
|
|
|
||||||
LL | T::<0 >= 3>;
|
|
||||||
| ^ expected expression
|
|
||||||
|
|
||||||
error: comparison operators cannot be chained
|
|
||||||
--> $DIR/closing-args-token.rs:27:12
|
|
||||||
|
|
|
||||||
LL | T::<x >>= 2 > 0>;
|
|
||||||
| ^^ ^
|
|
||||||
|
|
|
||||||
help: split the comparison into two
|
|
||||||
|
|
|
||||||
LL | T::<x >>= 2 && 2 > 0>;
|
|
||||||
| ++++
|
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// revisions: full min
|
|
||||||
|
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
|
||||||
|
|
||||||
fn foo<const N: usize>(v: &[u8; N]) -> &[u8] {
|
fn foo<const N: usize>(v: &[u8; N]) -> &[u8] {
|
||||||
v
|
v
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
// Test that a concrete const type i.e. A<2>, can be used as an argument type in a function
|
// Test that a concrete const type i.e. A<2>, can be used as an argument type in a function
|
||||||
// run-pass
|
// run-pass
|
||||||
// revisions: full min
|
|
||||||
|
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
|
||||||
|
|
||||||
struct A<const N: usize>; // ok
|
struct A<const N: usize>; // ok
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
// Test that a method/associated non-method within an impl block of a concrete const type i.e. A<2>,
|
// Test that a method/associated non-method within an impl block of a concrete const type i.e. A<2>,
|
||||||
// is callable.
|
// is callable.
|
||||||
// run-pass
|
// run-pass
|
||||||
// revisions: full min
|
|
||||||
|
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
|
||||||
|
|
||||||
pub struct A<const N: u32>;
|
pub struct A<const N: u32>;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// revisions: full min
|
// revisions: full min
|
||||||
|
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
#![cfg_attr(full, feature(generic_const_exprs))]
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
#![cfg_attr(full, allow(incomplete_features))]
|
||||||
|
|
||||||
trait IsZeroTrait<const IS_ZERO: bool>{}
|
trait IsZeroTrait<const IS_ZERO: bool>{}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
#![feature(const_generics, const_evaluatable_checked)]
|
#![feature(generic_const_exprs)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
// This tests that the `conservative_is_privately_uninhabited` fn doesn't cause
|
// This tests that the `conservative_is_privately_uninhabited` fn doesn't cause
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
#![feature(const_generics, const_evaluatable_checked)]
|
#![feature(generic_const_exprs)]
|
||||||
#![allow(incomplete_features)]
|
#![allow(incomplete_features)]
|
||||||
|
|
||||||
// This tests that the `conservative_is_privately_uninhabited` fn doesn't cause
|
// This tests that the `conservative_is_privately_uninhabited` fn doesn't cause
|
||||||
|
|
|
@ -5,7 +5,7 @@ LL | let _: [u8; foo::<T>()];
|
||||||
| ^ cannot perform const operation using `T`
|
| ^ cannot perform const operation using `T`
|
||||||
|
|
|
|
||||||
= note: type parameters may not be used in const expressions
|
= 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(generic_const_exprs)]` to allow generic const expressions
|
||||||
|
|
||||||
error: generic parameters may not be used in const operations
|
error: generic parameters may not be used in const operations
|
||||||
--> $DIR/const-arg-in-const-arg.rs:14:23
|
--> $DIR/const-arg-in-const-arg.rs:14:23
|
||||||
|
@ -14,7 +14,7 @@ LL | let _: [u8; bar::<N>()];
|
||||||
| ^ cannot perform const operation using `N`
|
| ^ cannot perform const operation using `N`
|
||||||
|
|
|
|
||||||
= help: const parameters may only be used as standalone arguments, i.e. `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(generic_const_exprs)]` to allow generic const expressions
|
||||||
|
|
||||||
error: generic parameters may not be used in const operations
|
error: generic parameters may not be used in const operations
|
||||||
--> $DIR/const-arg-in-const-arg.rs:24:23
|
--> $DIR/const-arg-in-const-arg.rs:24:23
|
||||||
|
@ -23,7 +23,7 @@ LL | let _ = [0; bar::<N>()];
|
||||||
| ^ cannot perform const operation using `N`
|
| ^ cannot perform const operation using `N`
|
||||||
|
|
|
|
||||||
= help: const parameters may only be used as standalone arguments, i.e. `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(generic_const_exprs)]` to allow generic const expressions
|
||||||
|
|
||||||
error: generic parameters may not be used in const operations
|
error: generic parameters may not be used in const operations
|
||||||
--> $DIR/const-arg-in-const-arg.rs:29:24
|
--> $DIR/const-arg-in-const-arg.rs:29:24
|
||||||
|
@ -32,7 +32,7 @@ LL | let _: Foo<{ foo::<T>() }>;
|
||||||
| ^ cannot perform const operation using `T`
|
| ^ cannot perform const operation using `T`
|
||||||
|
|
|
|
||||||
= note: type parameters may not be used in const expressions
|
= 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(generic_const_exprs)]` to allow generic const expressions
|
||||||
|
|
||||||
error: generic parameters may not be used in const operations
|
error: generic parameters may not be used in const operations
|
||||||
--> $DIR/const-arg-in-const-arg.rs:30:24
|
--> $DIR/const-arg-in-const-arg.rs:30:24
|
||||||
|
@ -41,7 +41,7 @@ LL | let _: Foo<{ bar::<N>() }>;
|
||||||
| ^ cannot perform const operation using `N`
|
| ^ cannot perform const operation using `N`
|
||||||
|
|
|
|
||||||
= help: const parameters may only be used as standalone arguments, i.e. `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(generic_const_exprs)]` to allow generic const expressions
|
||||||
|
|
||||||
error: generic parameters may not be used in const operations
|
error: generic parameters may not be used in const operations
|
||||||
--> $DIR/const-arg-in-const-arg.rs:35:27
|
--> $DIR/const-arg-in-const-arg.rs:35:27
|
||||||
|
@ -50,7 +50,7 @@ LL | let _ = Foo::<{ foo::<T>() }>;
|
||||||
| ^ cannot perform const operation using `T`
|
| ^ cannot perform const operation using `T`
|
||||||
|
|
|
|
||||||
= note: type parameters may not be used in const expressions
|
= 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(generic_const_exprs)]` to allow generic const expressions
|
||||||
|
|
||||||
error: generic parameters may not be used in const operations
|
error: generic parameters may not be used in const operations
|
||||||
--> $DIR/const-arg-in-const-arg.rs:36:27
|
--> $DIR/const-arg-in-const-arg.rs:36:27
|
||||||
|
@ -59,7 +59,7 @@ LL | let _ = Foo::<{ bar::<N>() }>;
|
||||||
| ^ cannot perform const operation using `N`
|
| ^ cannot perform const operation using `N`
|
||||||
|
|
|
|
||||||
= help: const parameters may only be used as standalone arguments, i.e. `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(generic_const_exprs)]` to allow generic const expressions
|
||||||
|
|
||||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
--> $DIR/const-arg-in-const-arg.rs:15:23
|
--> $DIR/const-arg-in-const-arg.rs:15:23
|
||||||
|
@ -67,8 +67,8 @@ error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
LL | let _: [u8; faz::<'a>(&())];
|
LL | let _: [u8; faz::<'a>(&())];
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||||
= help: add `#![feature(const_generics)]` to the crate attributes to enable
|
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
--> $DIR/const-arg-in-const-arg.rs:16:23
|
--> $DIR/const-arg-in-const-arg.rs:16:23
|
||||||
|
@ -76,8 +76,8 @@ error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
LL | let _: [u8; baz::<'a>(&())];
|
LL | let _: [u8; baz::<'a>(&())];
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||||
= help: add `#![feature(const_generics)]` to the crate attributes to enable
|
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
--> $DIR/const-arg-in-const-arg.rs:17:23
|
--> $DIR/const-arg-in-const-arg.rs:17:23
|
||||||
|
@ -85,8 +85,8 @@ error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
LL | let _: [u8; faz::<'b>(&())];
|
LL | let _: [u8; faz::<'b>(&())];
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||||
= help: add `#![feature(const_generics)]` to the crate attributes to enable
|
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
--> $DIR/const-arg-in-const-arg.rs:18:23
|
--> $DIR/const-arg-in-const-arg.rs:18:23
|
||||||
|
@ -94,8 +94,8 @@ error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
LL | let _: [u8; baz::<'b>(&())];
|
LL | let _: [u8; baz::<'b>(&())];
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||||
= help: add `#![feature(const_generics)]` to the crate attributes to enable
|
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
--> $DIR/const-arg-in-const-arg.rs:25:23
|
--> $DIR/const-arg-in-const-arg.rs:25:23
|
||||||
|
@ -103,8 +103,8 @@ error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
LL | let _ = [0; faz::<'a>(&())];
|
LL | let _ = [0; faz::<'a>(&())];
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||||
= help: add `#![feature(const_generics)]` to the crate attributes to enable
|
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
--> $DIR/const-arg-in-const-arg.rs:26:23
|
--> $DIR/const-arg-in-const-arg.rs:26:23
|
||||||
|
@ -112,8 +112,8 @@ error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
LL | let _ = [0; baz::<'a>(&())];
|
LL | let _ = [0; baz::<'a>(&())];
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||||
= help: add `#![feature(const_generics)]` to the crate attributes to enable
|
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
--> $DIR/const-arg-in-const-arg.rs:27:23
|
--> $DIR/const-arg-in-const-arg.rs:27:23
|
||||||
|
@ -121,8 +121,8 @@ error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
LL | let _ = [0; faz::<'b>(&())];
|
LL | let _ = [0; faz::<'b>(&())];
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||||
= help: add `#![feature(const_generics)]` to the crate attributes to enable
|
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
--> $DIR/const-arg-in-const-arg.rs:28:23
|
--> $DIR/const-arg-in-const-arg.rs:28:23
|
||||||
|
@ -130,8 +130,8 @@ error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
LL | let _ = [0; baz::<'b>(&())];
|
LL | let _ = [0; baz::<'b>(&())];
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||||
= help: add `#![feature(const_generics)]` to the crate attributes to enable
|
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
--> $DIR/const-arg-in-const-arg.rs:31:24
|
--> $DIR/const-arg-in-const-arg.rs:31:24
|
||||||
|
@ -139,8 +139,8 @@ error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
LL | let _: Foo<{ faz::<'a>(&()) }>;
|
LL | let _: Foo<{ faz::<'a>(&()) }>;
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||||
= help: add `#![feature(const_generics)]` to the crate attributes to enable
|
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
--> $DIR/const-arg-in-const-arg.rs:32:24
|
--> $DIR/const-arg-in-const-arg.rs:32:24
|
||||||
|
@ -148,8 +148,8 @@ error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
LL | let _: Foo<{ baz::<'a>(&()) }>;
|
LL | let _: Foo<{ baz::<'a>(&()) }>;
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||||
= help: add `#![feature(const_generics)]` to the crate attributes to enable
|
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
--> $DIR/const-arg-in-const-arg.rs:33:24
|
--> $DIR/const-arg-in-const-arg.rs:33:24
|
||||||
|
@ -157,8 +157,8 @@ error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
LL | let _: Foo<{ faz::<'b>(&()) }>;
|
LL | let _: Foo<{ faz::<'b>(&()) }>;
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||||
= help: add `#![feature(const_generics)]` to the crate attributes to enable
|
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
--> $DIR/const-arg-in-const-arg.rs:34:24
|
--> $DIR/const-arg-in-const-arg.rs:34:24
|
||||||
|
@ -166,8 +166,8 @@ error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
LL | let _: Foo<{ baz::<'b>(&()) }>;
|
LL | let _: Foo<{ baz::<'b>(&()) }>;
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||||
= help: add `#![feature(const_generics)]` to the crate attributes to enable
|
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
--> $DIR/const-arg-in-const-arg.rs:37:27
|
--> $DIR/const-arg-in-const-arg.rs:37:27
|
||||||
|
@ -175,8 +175,8 @@ error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
LL | let _ = Foo::<{ faz::<'a>(&()) }>;
|
LL | let _ = Foo::<{ faz::<'a>(&()) }>;
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||||
= help: add `#![feature(const_generics)]` to the crate attributes to enable
|
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
--> $DIR/const-arg-in-const-arg.rs:38:27
|
--> $DIR/const-arg-in-const-arg.rs:38:27
|
||||||
|
@ -184,8 +184,8 @@ error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
LL | let _ = Foo::<{ baz::<'a>(&()) }>;
|
LL | let _ = Foo::<{ baz::<'a>(&()) }>;
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||||
= help: add `#![feature(const_generics)]` to the crate attributes to enable
|
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
--> $DIR/const-arg-in-const-arg.rs:39:27
|
--> $DIR/const-arg-in-const-arg.rs:39:27
|
||||||
|
@ -193,8 +193,8 @@ error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
LL | let _ = Foo::<{ faz::<'b>(&()) }>;
|
LL | let _ = Foo::<{ faz::<'b>(&()) }>;
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||||
= help: add `#![feature(const_generics)]` to the crate attributes to enable
|
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: a non-static lifetime is not allowed in a `const`
|
error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
--> $DIR/const-arg-in-const-arg.rs:40:27
|
--> $DIR/const-arg-in-const-arg.rs:40:27
|
||||||
|
@ -202,8 +202,8 @@ error[E0658]: a non-static lifetime is not allowed in a `const`
|
||||||
LL | let _ = Foo::<{ baz::<'b>(&()) }>;
|
LL | let _ = Foo::<{ baz::<'b>(&()) }>;
|
||||||
| ^^
|
| ^^
|
||||||
|
|
|
|
||||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
|
||||||
= help: add `#![feature(const_generics)]` to the crate attributes to enable
|
= help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error: aborting due to 23 previous errors
|
error: aborting due to 23 previous errors
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// revisions: min
|
// revisions: min
|
||||||
// FIXME(const_generics): This test currently causes an ICE because
|
// FIXME(generic_const_exprs): This test currently causes an ICE because
|
||||||
// we don't yet correctly deal with lifetimes, reenable this test once
|
// we don't yet correctly deal with lifetimes, reenable this test once
|
||||||
// this is fixed.
|
// this is fixed.
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
// revisions: full min
|
|
||||||
|
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
|
||||||
|
|
||||||
fn const_u32_identity<const X: u32>() -> u32 {
|
fn const_u32_identity<const X: u32>() -> u32 {
|
||||||
X
|
X
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
error[E0747]: constant provided when a type was expected
|
|
||||||
--> $DIR/const-arg-type-arg-misordered.rs:7:35
|
|
||||||
|
|
|
||||||
LL | fn foo<const N: usize>() -> Array<N, ()> {
|
|
||||||
| ^
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0747`.
|
|
|
@ -1,7 +1,3 @@
|
||||||
// revisions: full min
|
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
|
||||||
|
|
||||||
type Array<T, const N: usize> = [T; N];
|
type Array<T, const N: usize> = [T; N];
|
||||||
|
|
||||||
fn foo<const N: usize>() -> Array<N, ()> {
|
fn foo<const N: usize>() -> Array<N, ()> {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0747]: constant provided when a type was expected
|
error[E0747]: constant provided when a type was expected
|
||||||
--> $DIR/const-arg-type-arg-misordered.rs:7:35
|
--> $DIR/const-arg-type-arg-misordered.rs:3:35
|
||||||
|
|
|
|
||||||
LL | fn foo<const N: usize>() -> Array<N, ()> {
|
LL | fn foo<const N: usize>() -> Array<N, ()> {
|
||||||
| ^
|
| ^
|
|
@ -1,15 +0,0 @@
|
||||||
error[E0308]: mismatched types
|
|
||||||
--> $DIR/const-argument-cross-crate-mismatch.rs:9:67
|
|
||||||
|
|
|
||||||
LL | let _ = const_generic_lib::function(const_generic_lib::Struct([0u8, 1u8]));
|
|
||||||
| ^^^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements
|
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
|
||||||
--> $DIR/const-argument-cross-crate-mismatch.rs:11:65
|
|
||||||
|
|
|
||||||
LL | let _: const_generic_lib::Alias = const_generic_lib::Struct([0u8, 1u8, 2u8]);
|
|
||||||
| ^^^^^^^^^^^^^^^ expected an array with a fixed size of 2 elements, found one with 3 elements
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0308`.
|
|
|
@ -1,7 +1,4 @@
|
||||||
// aux-build:const_generic_lib.rs
|
// aux-build:const_generic_lib.rs
|
||||||
// revisions: full min
|
|
||||||
#![cfg_attr(full, feature(const_generics))]
|
|
||||||
#![cfg_attr(full, allow(incomplete_features))]
|
|
||||||
|
|
||||||
extern crate const_generic_lib;
|
extern crate const_generic_lib;
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue