From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../abstract-const-as-cast-1.rs | 18 -- .../abstract-const-as-cast-2.rs | 20 --- .../abstract-const-as-cast-2.stderr | 26 --- .../abstract-const-as-cast-3.rs | 47 ------ .../abstract-const-as-cast-3.stderr | 187 --------------------- .../abstract-const-as-cast-4.rs | 29 ---- .../abstract-consts-as-cast-5.rs | 11 -- .../abstract-consts-as-cast-5.stderr | 10 -- .../array-size-in-generic-struct-param.full.stderr | 19 --- .../array-size-in-generic-struct-param.min.stderr | 29 ---- .../array-size-in-generic-struct-param.rs | 29 ---- .../const_equate_assoc_consts.rs | 27 --- .../doesnt_unify_evaluatable.rs | 15 -- .../doesnt_unify_evaluatable.stderr | 10 -- .../dropck_unifies_assoc_consts.rs | 20 --- .../assoc_const_unification/unifies_evaluatable.rs | 18 -- .../generic_const_exprs/associated-const.rs | 11 -- .../generic_const_exprs/associated-consts.rs | 31 ---- .../auxiliary/const_evaluatable_lib.rs | 9 - .../auxiliary/issue-94287-aux.rs | 21 --- .../const-generics/generic_const_exprs/closures.rs | 6 - .../generic_const_exprs/closures.stderr | 26 --- .../const_eval_resolve_canonical.rs | 28 --- .../const_kind_expr/wf_obligation.rs | 22 --- .../const_kind_expr/wf_obligation.stderr | 20 --- .../generic_const_exprs/cross_crate.rs | 15 -- .../generic_const_exprs/cross_crate_predicate.rs | 14 -- .../cross_crate_predicate.stderr | 54 ------ .../dependence_lint.full.stderr | 39 ----- .../generic_const_exprs/dependence_lint.gce.stderr | 34 ---- .../generic_const_exprs/dependence_lint.rs | 26 --- .../generic_const_exprs/different-fn.rs | 17 -- .../generic_const_exprs/different-fn.stderr | 20 --- .../const-generics/generic_const_exprs/division.rs | 11 -- .../dont-eagerly-error-in-is-const-evaluatable.rs | 16 -- .../generic_const_exprs/drop_impl.rs | 16 -- .../generic_const_exprs/elaborate-trait-pred.rs | 24 --- .../generic_const_exprs/eval-privacy.rs | 26 --- .../generic_const_exprs/eval-privacy.stderr | 12 -- .../generic_const_exprs/eval-try-unify.rs | 26 --- .../generic_const_exprs/eval-try-unify.stderr | 11 -- .../generic_const_exprs/evaluated-to-ambig.rs | 22 --- .../feature-gate-generic_const_exprs.rs | 11 -- .../feature-gate-generic_const_exprs.stderr | 11 -- .../const-generics/generic_const_exprs/fn_call.rs | 30 ---- .../generic_const_exprs/from-sig-fail.rs | 11 -- .../generic_const_exprs/from-sig-fail.stderr | 9 - .../const-generics/generic_const_exprs/from-sig.rs | 14 -- .../generic_const_exprs/function-call.rs | 20 --- .../generic_const_exprs/function-call.stderr | 12 -- .../generic_const_exprs/impl-bounds.rs | 25 --- .../generic_const_exprs/infer-too-generic.rs | 24 --- .../generic_const_exprs/issue-100217.rs | 42 ----- .../generic_const_exprs/issue-100360.rs | 13 -- .../generic_const_exprs/issue-102074.rs | 23 --- .../generic_const_exprs/issue-102768.rs | 14 -- .../generic_const_exprs/issue-102768.stderr | 33 ---- .../generic_const_exprs/issue-62504.full.stderr | 20 --- .../generic_const_exprs/issue-62504.min.stderr | 27 --- .../generic_const_exprs/issue-62504.rs | 27 --- .../generic_const_exprs/issue-69654.rs | 19 --- .../generic_const_exprs/issue-69654.stderr | 24 --- .../generic_const_exprs/issue-72787.min.stderr | 55 ------ .../generic_const_exprs/issue-72787.rs | 35 ---- .../issue-72819-generic-in-const-eval.full.stderr | 35 ---- .../issue-72819-generic-in-const-eval.min.stderr | 11 -- .../issue-72819-generic-in-const-eval.rs | 23 --- .../generic_const_exprs/issue-73298.rs | 23 --- .../generic_const_exprs/issue-73899.rs | 20 --- .../generic_const_exprs/issue-74634.rs | 28 --- .../generic_const_exprs/issue-74713.rs | 8 - .../generic_const_exprs/issue-74713.stderr | 22 --- .../generic_const_exprs/issue-76595.rs | 17 -- .../generic_const_exprs/issue-76595.stderr | 21 --- ...sue-79518-default_trait_method_normalization.rs | 21 --- ...79518-default_trait_method_normalization.stderr | 14 -- .../issue-80561-incorrect-param-env.rs | 24 --- .../generic_const_exprs/issue-80742.rs | 32 ---- .../generic_const_exprs/issue-80742.stderr | 72 -------- .../generic_const_exprs/issue-82268.rs | 73 -------- .../generic_const_exprs/issue-83765.rs | 38 ----- .../generic_const_exprs/issue-83765.stderr | 34 ---- .../generic_const_exprs/issue-83972.rs | 38 ----- .../generic_const_exprs/issue-84408.rs | 38 ----- .../generic_const_exprs/issue-84669.rs | 30 ---- .../generic_const_exprs/issue-85848.rs | 32 ---- .../generic_const_exprs/issue-85848.stderr | 63 ------- .../generic_const_exprs/issue-86710.rs | 73 -------- .../generic_const_exprs/issue-89851.rs | 12 -- .../generic_const_exprs/issue-90847.rs | 9 - .../generic_const_exprs/issue-94287.rs | 10 -- .../generic_const_exprs/issue-94287.stderr | 15 -- .../generic_const_exprs/issue-97047-ice-1.rs | 25 --- .../generic_const_exprs/issue-97047-ice-1.stderr | 19 --- .../generic_const_exprs/issue-97047-ice-2.rs | 23 --- .../generic_const_exprs/issue-97047-ice-2.stderr | 19 --- .../generic_const_exprs/issue-99705.rs | 33 ---- .../generic_const_exprs/less_than.rs | 14 -- .../generic_const_exprs/let-bindings.rs | 15 -- .../generic_const_exprs/let-bindings.stderr | 20 --- .../generic_const_exprs/needs_where_clause.rs | 14 -- .../generic_const_exprs/needs_where_clause.stderr | 10 -- .../nested-abstract-consts-1.rs | 24 --- .../nested-abstract-consts-2.rs | 35 ---- .../nested_uneval_unification-1.rs | 34 ---- .../nested_uneval_unification-2.rs | 29 ---- .../generic_const_exprs/no_dependence.rs | 13 -- .../generic_const_exprs/no_where_clause.rs | 29 ---- .../generic_const_exprs/no_where_clause.stderr | 10 -- .../normed_to_param_is_evaluatable.rs | 12 -- .../generic_const_exprs/object-safety-err-ret.rs | 21 --- .../object-safety-err-ret.stderr | 18 -- .../object-safety-err-where-bounds.rs | 22 --- .../object-safety-err-where-bounds.stderr | 24 --- .../object-safety-ok-infer-err.rs | 21 --- .../object-safety-ok-infer-err.stderr | 19 --- .../generic_const_exprs/object-safety-ok.rs | 21 --- .../generic_const_exprs/obligation-cause.rs | 24 --- .../generic_const_exprs/obligation-cause.stderr | 20 --- .../generic_const_exprs/simple_fail.rs | 17 -- .../generic_const_exprs/simple_fail.stderr | 15 -- .../subexprs_are_const_evalutable.rs | 17 -- .../generic_const_exprs/ty-alias-substitution.rs | 14 -- .../generic_const_exprs/unify-op-with-fn-call.rs | 35 ---- .../unify-op-with-fn-call.stderr | 10 -- .../ui/const-generics/generic_const_exprs/unop.rs | 14 -- .../unused-complex-default-expr.rs | 6 - .../generic_const_exprs/unused_expr.rs | 25 --- .../generic_const_exprs/unused_expr.stderr | 29 ---- 129 files changed, 3157 deletions(-) delete mode 100644 src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-1.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-2.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-2.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-4.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/abstract-consts-as-cast-5.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/abstract-consts-as-cast-5.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.full.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/const_equate_assoc_consts.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/dropck_unifies_assoc_consts.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/unifies_evaluatable.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/associated-const.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/associated-consts.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/auxiliary/const_evaluatable_lib.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/auxiliary/issue-94287-aux.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/closures.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/closures.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/cross_crate.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/cross_crate_predicate.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/cross_crate_predicate.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/dependence_lint.full.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/dependence_lint.gce.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/dependence_lint.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/different-fn.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/different-fn.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/division.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/dont-eagerly-error-in-is-const-evaluatable.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/drop_impl.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/elaborate-trait-pred.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/eval-privacy.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/eval-privacy.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/eval-try-unify.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/eval-try-unify.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/evaluated-to-ambig.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/feature-gate-generic_const_exprs.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/feature-gate-generic_const_exprs.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/fn_call.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/from-sig-fail.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/from-sig-fail.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/from-sig.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/function-call.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/function-call.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/impl-bounds.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/infer-too-generic.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-100217.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-100360.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-102074.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-102768.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-102768.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-62504.full.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-62504.min.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-62504.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-69654.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-69654.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-72787.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.full.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.min.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-73298.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-73899.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-74634.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-74713.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-74713.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-76595.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-76595.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-80561-incorrect-param-env.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-80742.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-80742.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-82268.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-83765.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-83765.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-83972.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-84408.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-84669.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-85848.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-85848.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-86710.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-89851.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-90847.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-94287.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-94287.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/issue-99705.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/less_than.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/let-bindings.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/let-bindings.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/needs_where_clause.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/needs_where_clause.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/nested-abstract-consts-1.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/nested-abstract-consts-2.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/nested_uneval_unification-1.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/nested_uneval_unification-2.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/no_dependence.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/no_where_clause.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/no_where_clause.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/normed_to_param_is_evaluatable.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/object-safety-err-ret.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/object-safety-err-where-bounds.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/object-safety-err-where-bounds.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/object-safety-ok.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/obligation-cause.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/obligation-cause.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/simple_fail.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/simple_fail.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/subexprs_are_const_evalutable.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/ty-alias-substitution.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr delete mode 100644 src/test/ui/const-generics/generic_const_exprs/unop.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/unused-complex-default-expr.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/unused_expr.rs delete mode 100644 src/test/ui/const-generics/generic_const_exprs/unused_expr.stderr (limited to 'src/test/ui/const-generics/generic_const_exprs') diff --git a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-1.rs b/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-1.rs deleted file mode 100644 index 06f00de13..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-1.rs +++ /dev/null @@ -1,18 +0,0 @@ -// check-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -struct Foo([u8; N as usize]) -where - [(); N as usize]:; - -struct Bar([u8; (N + 2) as usize]) where [(); (N + 2) as usize]:; - -// unifying with subtrees -struct Evaluatable; -fn foo() where Evaluatable<{N as usize as u16 }>: { - let _ = Foo::([1; N as usize]); -} - - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-2.rs b/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-2.rs deleted file mode 100644 index 3b5b87b2b..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-2.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -struct Evaluatable {} - -struct Foo([u8; N as usize]) -//~^ Error: unconstrained generic constant -//~| help: try adding a `where` bound using this expression: `where [(); N as usize]:` -where - Evaluatable<{N as u128}>:; - -struct Foo2(Evaluatable::<{N as u128}>) where Evaluatable<{N as usize as u128 }>:; -//~^ Error: unconstrained generic constant -//~| help: try adding a `where` bound using this expression: `where [(); {N as u128}]:` - -struct Bar([u8; (N + 2) as usize]) where [(); (N + 1) as usize]:; -//~^ Error: unconstrained generic constant -//~| help: try adding a `where` bound using this expression: `where [(); (N + 2) as usize]:` - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-2.stderr b/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-2.stderr deleted file mode 100644 index 5ca04d25e..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-2.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error: unconstrained generic constant - --> $DIR/abstract-const-as-cast-2.rs:6:25 - | -LL | struct Foo([u8; N as usize]) - | ^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); N as usize]:` - -error: unconstrained generic constant - --> $DIR/abstract-const-as-cast-2.rs:12:26 - | -LL | struct Foo2(Evaluatable::<{N as u128}>) where Evaluatable<{N as usize as u128 }>:; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); {N as u128}]:` - -error: unconstrained generic constant - --> $DIR/abstract-const-as-cast-2.rs:16:25 - | -LL | struct Bar([u8; (N + 2) as usize]) where [(); (N + 1) as usize]:; - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); (N + 2) as usize]:` - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.rs b/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.rs deleted file mode 100644 index 7561ae2fe..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.rs +++ /dev/null @@ -1,47 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait Trait {} -pub struct EvaluatableU128; - -struct HasCastInTraitImpl; -impl Trait for HasCastInTraitImpl {} - -pub fn use_trait_impl() -where - [(); { N + 1}]:, - EvaluatableU128<{N as u128}>:, { - fn assert_impl() {} - - // errors are bad but seems to be pre-existing issue #86198 - assert_impl::>(); - //~^ Error: mismatched types - //~^^ Error: unconstrained generic constant - assert_impl::>(); - //~^ Error: mismatched types - //~^^ Error: unconstrained generic constant - assert_impl::>(); - //~^ Error: mismatched types - assert_impl::>(); - //~^ Error: mismatched types -} -pub fn use_trait_impl_2() -where - [(); { N + 1}]:, - EvaluatableU128<{N as _}>:, { - fn assert_impl() {} - - // errors are bad but seems to be pre-existing issue #86198 - assert_impl::>(); - //~^ Error: mismatched types - //~^^ Error: unconstrained generic constant - assert_impl::>(); - //~^ Error: mismatched types - //~^^ Error: unconstrained generic constant - assert_impl::>(); - //~^ Error: mismatched types - assert_impl::>(); - //~^ Error: mismatched types -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr b/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr deleted file mode 100644 index ada1050d3..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr +++ /dev/null @@ -1,187 +0,0 @@ -error: unconstrained generic constant - --> $DIR/abstract-const-as-cast-3.rs:17:19 - | -LL | assert_impl::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); { O as u128 }]:` -note: required for `HasCastInTraitImpl<{ N + 1 }, { N as u128 }>` to implement `Trait` - --> $DIR/abstract-const-as-cast-3.rs:8:22 - | -LL | impl Trait for HasCastInTraitImpl {} - | ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `use_trait_impl::assert_impl` - --> $DIR/abstract-const-as-cast-3.rs:14:23 - | -LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` - -error[E0308]: mismatched types - --> $DIR/abstract-const-as-cast-3.rs:17:5 - | -LL | assert_impl::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{ N as u128 }`, found `{ O as u128 }` - | - = note: expected constant `{ N as u128 }` - found constant `{ O as u128 }` -note: required by a bound in `use_trait_impl::assert_impl` - --> $DIR/abstract-const-as-cast-3.rs:14:23 - | -LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` - -error: unconstrained generic constant - --> $DIR/abstract-const-as-cast-3.rs:20:19 - | -LL | assert_impl::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); { O as u128 }]:` -note: required for `HasCastInTraitImpl<{ N + 1 }, { N as _ }>` to implement `Trait` - --> $DIR/abstract-const-as-cast-3.rs:8:22 - | -LL | impl Trait for HasCastInTraitImpl {} - | ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `use_trait_impl::assert_impl` - --> $DIR/abstract-const-as-cast-3.rs:14:23 - | -LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` - -error[E0308]: mismatched types - --> $DIR/abstract-const-as-cast-3.rs:20:5 - | -LL | assert_impl::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{ N as _ }`, found `{ O as u128 }` - | - = note: expected constant `{ N as _ }` - found constant `{ O as u128 }` -note: required by a bound in `use_trait_impl::assert_impl` - --> $DIR/abstract-const-as-cast-3.rs:14:23 - | -LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` - -error[E0308]: mismatched types - --> $DIR/abstract-const-as-cast-3.rs:23:5 - | -LL | assert_impl::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `12`, found `13` - | - = note: expected constant `12` - found constant `13` -note: required by a bound in `use_trait_impl::assert_impl` - --> $DIR/abstract-const-as-cast-3.rs:14:23 - | -LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` - -error[E0308]: mismatched types - --> $DIR/abstract-const-as-cast-3.rs:25:5 - | -LL | assert_impl::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `13`, found `14` - | - = note: expected constant `13` - found constant `14` -note: required by a bound in `use_trait_impl::assert_impl` - --> $DIR/abstract-const-as-cast-3.rs:14:23 - | -LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl::assert_impl` - -error: unconstrained generic constant - --> $DIR/abstract-const-as-cast-3.rs:35:19 - | -LL | assert_impl::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); { O as u128 }]:` -note: required for `HasCastInTraitImpl<{ N + 1 }, { N as u128 }>` to implement `Trait` - --> $DIR/abstract-const-as-cast-3.rs:8:22 - | -LL | impl Trait for HasCastInTraitImpl {} - | ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `use_trait_impl_2::assert_impl` - --> $DIR/abstract-const-as-cast-3.rs:32:23 - | -LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` - -error[E0308]: mismatched types - --> $DIR/abstract-const-as-cast-3.rs:35:5 - | -LL | assert_impl::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{ N as u128 }`, found `{ O as u128 }` - | - = note: expected constant `{ N as u128 }` - found constant `{ O as u128 }` -note: required by a bound in `use_trait_impl_2::assert_impl` - --> $DIR/abstract-const-as-cast-3.rs:32:23 - | -LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` - -error: unconstrained generic constant - --> $DIR/abstract-const-as-cast-3.rs:38:19 - | -LL | assert_impl::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); { O as u128 }]:` -note: required for `HasCastInTraitImpl<{ N + 1 }, { N as _ }>` to implement `Trait` - --> $DIR/abstract-const-as-cast-3.rs:8:22 - | -LL | impl Trait for HasCastInTraitImpl {} - | ^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: required by a bound in `use_trait_impl_2::assert_impl` - --> $DIR/abstract-const-as-cast-3.rs:32:23 - | -LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` - -error[E0308]: mismatched types - --> $DIR/abstract-const-as-cast-3.rs:38:5 - | -LL | assert_impl::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{ N as _ }`, found `{ O as u128 }` - | - = note: expected constant `{ N as _ }` - found constant `{ O as u128 }` -note: required by a bound in `use_trait_impl_2::assert_impl` - --> $DIR/abstract-const-as-cast-3.rs:32:23 - | -LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` - -error[E0308]: mismatched types - --> $DIR/abstract-const-as-cast-3.rs:41:5 - | -LL | assert_impl::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `12`, found `13` - | - = note: expected constant `12` - found constant `13` -note: required by a bound in `use_trait_impl_2::assert_impl` - --> $DIR/abstract-const-as-cast-3.rs:32:23 - | -LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` - -error[E0308]: mismatched types - --> $DIR/abstract-const-as-cast-3.rs:43:5 - | -LL | assert_impl::>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `13`, found `14` - | - = note: expected constant `13` - found constant `14` -note: required by a bound in `use_trait_impl_2::assert_impl` - --> $DIR/abstract-const-as-cast-3.rs:32:23 - | -LL | fn assert_impl() {} - | ^^^^^ required by this bound in `use_trait_impl_2::assert_impl` - -error: aborting due to 12 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-4.rs b/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-4.rs deleted file mode 100644 index 184263f89..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/abstract-const-as-cast-4.rs +++ /dev/null @@ -1,29 +0,0 @@ -// check-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait Trait {} -pub struct EvaluatableU128; - -struct HasCastInTraitImpl; -impl Trait for HasCastInTraitImpl {} - -pub fn use_trait_impl() where EvaluatableU128<{N as u128}>:, { - fn assert_impl() {} - - assert_impl::>(); - assert_impl::>(); - assert_impl::>(); - assert_impl::>(); -} -pub fn use_trait_impl_2() where EvaluatableU128<{N as _}>:, { - fn assert_impl() {} - - assert_impl::>(); - assert_impl::>(); - assert_impl::>(); - assert_impl::>(); -} - - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/abstract-consts-as-cast-5.rs b/src/test/ui/const-generics/generic_const_exprs/abstract-consts-as-cast-5.rs deleted file mode 100644 index 916d60c0e..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/abstract-consts-as-cast-5.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -fn foo(a: [(); N as usize]) { - bar::<{ N as usize as usize }>(); - //~^ error: unconstrained generic constant -} - -fn bar() {} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/abstract-consts-as-cast-5.stderr b/src/test/ui/const-generics/generic_const_exprs/abstract-consts-as-cast-5.stderr deleted file mode 100644 index d48b639db..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/abstract-consts-as-cast-5.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: unconstrained generic constant - --> $DIR/abstract-consts-as-cast-5.rs:5:11 - | -LL | bar::<{ N as usize as usize }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); { N as usize as usize }]:` - -error: aborting due to previous error - diff --git a/src/test/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.full.stderr b/src/test/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.full.stderr deleted file mode 100644 index 041232e86..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.full.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error: unconstrained generic constant - --> $DIR/array-size-in-generic-struct-param.rs:8:38 - | -LL | struct ArithArrayLen([u32; 0 + N]); - | ^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); 0 + N]:` - -error: overly complex generic constant - --> $DIR/array-size-in-generic-struct-param.rs:19:15 - | -LL | arr: [u8; CFG.arr_size], - | ^^^^^^^^^^^^ field access is not supported in generic constant - | - = help: consider moving this anonymous constant into a `const` function - = note: this operation may be supported in the future - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr b/src/test/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr deleted file mode 100644 index 18e9135d0..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.min.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error: generic parameters may not be used in const operations - --> $DIR/array-size-in-generic-struct-param.rs:8:48 - | -LL | struct ArithArrayLen([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(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 - | -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(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 - | -LL | struct B { - | ^^^^^^ - | - = note: the only supported types are integers, `bool` and `char` - = help: more complex types are supported with `#![feature(adt_const_params)]` - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.rs b/src/test/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.rs deleted file mode 100644 index 7d3fe413c..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/array-size-in-generic-struct-param.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Tests that array sizes that depend on const-params are checked using `ConstEvaluatable`. -// revisions: full min - -#![cfg_attr(full, feature(generic_const_exprs, adt_const_params))] -#![cfg_attr(full, allow(incomplete_features))] - -#[allow(dead_code)] -struct ArithArrayLen([u32; 0 + N]); -//[full]~^ ERROR unconstrained generic constant -//[min]~^^ ERROR generic parameters may not be used in const operations - -#[derive(PartialEq, Eq)] -struct Config { - arr_size: usize, -} - -struct B { - //[min]~^ ERROR `Config` is forbidden - arr: [u8; CFG.arr_size], - //[full]~^ ERROR overly complex generic constant - //[min]~^^ ERROR generic parameters may not be used in const operations -} - -const C: Config = Config { arr_size: 5 }; - -fn main() { - let b = B:: { arr: [1, 2, 3, 4, 5] }; - assert_eq!(b.arr.len(), 5); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/const_equate_assoc_consts.rs b/src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/const_equate_assoc_consts.rs deleted file mode 100644 index e8f89cb1a..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/const_equate_assoc_consts.rs +++ /dev/null @@ -1,27 +0,0 @@ -// check-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait Trait { - const ASSOC: usize; -} -impl Trait for T { - const ASSOC: usize = std::mem::size_of::(); -} - -struct Foo([u8; T::ASSOC]) -where - [(); T::ASSOC]:; - -fn bar() -where - [(); T::ASSOC]:, -{ - let _: Foo = Foo::<_>(make()); -} - -fn make() -> ! { - todo!() -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.rs b/src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.rs deleted file mode 100644 index c8f7553da..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait Trait { - const ASSOC: usize; -} - -fn foo() where [(); U::ASSOC]:, { - bar::<{ T::ASSOC }>(); - //~^ ERROR: unconstrained generic constant -} - -fn bar() {} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr b/src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr deleted file mode 100644 index e4a0cabe5..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: unconstrained generic constant - --> $DIR/doesnt_unify_evaluatable.rs:9:11 - | -LL | bar::<{ T::ASSOC }>(); - | ^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); { T::ASSOC }]:` - -error: aborting due to previous error - diff --git a/src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/dropck_unifies_assoc_consts.rs b/src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/dropck_unifies_assoc_consts.rs deleted file mode 100644 index 274caa1e9..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/dropck_unifies_assoc_consts.rs +++ /dev/null @@ -1,20 +0,0 @@ -// check-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait Trait { - const ASSOC: usize; -} - -struct Foo(T) -where - [(); T::ASSOC]:; - -impl Drop for Foo -where - [(); T::ASSOC]:, -{ - fn drop(&mut self) {} -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/unifies_evaluatable.rs b/src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/unifies_evaluatable.rs deleted file mode 100644 index 6597b9f2b..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/assoc_const_unification/unifies_evaluatable.rs +++ /dev/null @@ -1,18 +0,0 @@ -// check-pass - -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait Trait { - const ASSOC: usize; -} - -fn foo() where [(); T::ASSOC]:, { - bar::<{ T::ASSOC }>(); -} - -fn bar() -> [(); N] { - [(); N] -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/associated-const.rs b/src/test/ui/const-generics/generic_const_exprs/associated-const.rs deleted file mode 100644 index a67776322..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/associated-const.rs +++ /dev/null @@ -1,11 +0,0 @@ -// check-pass -struct Foo(T); -impl Foo { - const VALUE: usize = std::mem::size_of::(); -} - -fn test() { - let _ = [0; Foo::::VALUE]; -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/associated-consts.rs b/src/test/ui/const-generics/generic_const_exprs/associated-consts.rs deleted file mode 100644 index b839008d4..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/associated-consts.rs +++ /dev/null @@ -1,31 +0,0 @@ -// run-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -pub trait BlockCipher { - const BLOCK_SIZE: usize; -} - -struct FooCipher; -impl BlockCipher for FooCipher { - const BLOCK_SIZE: usize = 64; -} - -struct BarCipher; -impl BlockCipher for BarCipher { - const BLOCK_SIZE: usize = 32; -} - -pub struct Block(#[allow(unused_tuple_struct_fields)] C); - -pub fn test() -where - [u8; M - C::BLOCK_SIZE]: Sized, -{ - let _ = [0; M - C::BLOCK_SIZE]; -} - -fn main() { - test::(); - test::(); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/auxiliary/const_evaluatable_lib.rs b/src/test/ui/const-generics/generic_const_exprs/auxiliary/const_evaluatable_lib.rs deleted file mode 100644 index 15d618cae..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/auxiliary/const_evaluatable_lib.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -pub fn test1() -> [u8; std::mem::size_of::() - 1] -where - [u8; std::mem::size_of::() - 1]: Sized, -{ - [0; std::mem::size_of::() - 1] -} diff --git a/src/test/ui/const-generics/generic_const_exprs/auxiliary/issue-94287-aux.rs b/src/test/ui/const-generics/generic_const_exprs/auxiliary/issue-94287-aux.rs deleted file mode 100644 index df454dae7..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/auxiliary/issue-94287-aux.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![feature(generic_const_exprs)] - -use std::str::FromStr; - -pub struct If; - -pub trait True {} - -impl True for If {} - -pub struct FixedI32; - -impl FromStr for FixedI32 -where - If<{ FRAC <= 32 }>: True, -{ - type Err = (); - fn from_str(_s: &str) -> Result { - unimplemented!() - } -} diff --git a/src/test/ui/const-generics/generic_const_exprs/closures.rs b/src/test/ui/const-generics/generic_const_exprs/closures.rs deleted file mode 100644 index 1ea310d06..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/closures.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] -fn test() -> [u8; N + (|| 42)()] {} -//~^ ERROR cycle detected when building an abstract representation - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/closures.stderr b/src/test/ui/const-generics/generic_const_exprs/closures.stderr deleted file mode 100644 index a7d891d77..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/closures.stderr +++ /dev/null @@ -1,26 +0,0 @@ -error[E0391]: cycle detected when building an abstract representation for `test::{constant#0}` - --> $DIR/closures.rs:3:35 - | -LL | fn test() -> [u8; N + (|| 42)()] {} - | ^^^^^^^^^^^^^ - | -note: ...which requires building THIR for `test::{constant#0}`... - --> $DIR/closures.rs:3:35 - | -LL | fn test() -> [u8; N + (|| 42)()] {} - | ^^^^^^^^^^^^^ -note: ...which requires type-checking `test::{constant#0}`... - --> $DIR/closures.rs:3:35 - | -LL | fn test() -> [u8; N + (|| 42)()] {} - | ^^^^^^^^^^^^^ - = note: ...which again requires building an abstract representation for `test::{constant#0}`, completing the cycle -note: cycle used when checking that `test` is well-formed - --> $DIR/closures.rs:3:1 - | -LL | fn test() -> [u8; N + (|| 42)()] {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0391`. diff --git a/src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.rs b/src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.rs deleted file mode 100644 index 5874625ad..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/const_eval_resolve_canonical.rs +++ /dev/null @@ -1,28 +0,0 @@ -// check-pass - -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait Foo { - type Assoc: Default; -} - -impl Foo<0> for () { - type Assoc = u32; -} - -impl Foo<3> for () { - type Assoc = i64; -} - -fn foo(_: T) -> <() as Foo<{ N + 1 }>>::Assoc -where - (): Foo<{ N + 1 }>, -{ - Default::default() -} - -fn main() { - let mut _q = Default::default(); - _q = foo::<_, 2>(_q); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.rs b/src/test/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.rs deleted file mode 100644 index 6093fc70b..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.rs +++ /dev/null @@ -1,22 +0,0 @@ -#![feature(generic_const_exprs, generic_arg_infer)] -#![allow(incomplete_features)] - -// minimized repro for #105205 -// -// the `foo::<_, L>` call results in a `WellFormed(_)` obligation and a -// `ConstEvaluatable(Unevaluated(_ + 1 + L))` obligation. Attempting to fulfill the latter -// unifies the `_` with `Expr(L - 1)` from the paramenv which turns the `WellFormed` -// obligation into `WellFormed(Expr(L - 1))` - -fn foo(_: [(); N + 1 + M]) {} - -fn ice() -where - [(); (L - 1) + 1 + L]:, -{ - foo::<_, L>([(); L + 1 + L]); - //~^ ERROR: mismatched types - //~^^ ERROR: unconstrained generic constant -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr b/src/test/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr deleted file mode 100644 index da5194696..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/wf_obligation.rs:17:17 - | -LL | foo::<_, L>([(); L + 1 + L]); - | ^^^^^^^^^^^^^^^ expected `N + 1 + M`, found `L + 1 + L` - | - = note: expected constant `N + 1 + M` - found constant `L + 1 + L` - -error: unconstrained generic constant - --> $DIR/wf_obligation.rs:17:22 - | -LL | foo::<_, L>([(); L + 1 + L]); - | ^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); L + 1 + L]:` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/generic_const_exprs/cross_crate.rs b/src/test/ui/const-generics/generic_const_exprs/cross_crate.rs deleted file mode 100644 index dfc69e0b0..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/cross_crate.rs +++ /dev/null @@ -1,15 +0,0 @@ -// aux-build:const_evaluatable_lib.rs -// run-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] -extern crate const_evaluatable_lib; - -fn user() where [u8; std::mem::size_of::() - 1]: Sized { - assert_eq!(const_evaluatable_lib::test1::(), [0; std::mem::size_of::() - 1]); -} - -fn main() { - assert_eq!(const_evaluatable_lib::test1::(), [0; 3]); - user::(); - user::(); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/cross_crate_predicate.rs b/src/test/ui/const-generics/generic_const_exprs/cross_crate_predicate.rs deleted file mode 100644 index b08fffd69..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/cross_crate_predicate.rs +++ /dev/null @@ -1,14 +0,0 @@ -// aux-build:const_evaluatable_lib.rs -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] -extern crate const_evaluatable_lib; - -fn user() { - let _ = const_evaluatable_lib::test1::(); - //~^ ERROR unconstrained generic constant - //~| ERROR unconstrained generic constant - //~| ERROR unconstrained generic constant - //~| ERROR unconstrained generic constant -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/cross_crate_predicate.stderr b/src/test/ui/const-generics/generic_const_exprs/cross_crate_predicate.stderr deleted file mode 100644 index 7b4d46b82..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/cross_crate_predicate.stderr +++ /dev/null @@ -1,54 +0,0 @@ -error: unconstrained generic constant - --> $DIR/cross_crate_predicate.rs:7:13 - | -LL | let _ = const_evaluatable_lib::test1::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::() - 1]:` -note: required by a bound in `test1` - --> $DIR/auxiliary/const_evaluatable_lib.rs:6:10 - | -LL | [u8; std::mem::size_of::() - 1]: Sized, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `test1` - -error: unconstrained generic constant - --> $DIR/cross_crate_predicate.rs:7:13 - | -LL | let _ = const_evaluatable_lib::test1::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::() - 1]:` -note: required by a bound in `test1` - --> $DIR/auxiliary/const_evaluatable_lib.rs:4:27 - | -LL | pub fn test1() -> [u8; std::mem::size_of::() - 1] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `test1` - -error: unconstrained generic constant - --> $DIR/cross_crate_predicate.rs:7:13 - | -LL | let _ = const_evaluatable_lib::test1::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::() - 1]:` -note: required by a bound in `test1` - --> $DIR/auxiliary/const_evaluatable_lib.rs:6:10 - | -LL | [u8; std::mem::size_of::() - 1]: Sized, - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `test1` - -error: unconstrained generic constant - --> $DIR/cross_crate_predicate.rs:7:13 - | -LL | let _ = const_evaluatable_lib::test1::(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); std::mem::size_of::() - 1]:` -note: required by a bound in `test1` - --> $DIR/auxiliary/const_evaluatable_lib.rs:4:27 - | -LL | pub fn test1() -> [u8; std::mem::size_of::() - 1] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `test1` - -error: aborting due to 4 previous errors - diff --git a/src/test/ui/const-generics/generic_const_exprs/dependence_lint.full.stderr b/src/test/ui/const-generics/generic_const_exprs/dependence_lint.full.stderr deleted file mode 100644 index d674e3acd..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/dependence_lint.full.stderr +++ /dev/null @@ -1,39 +0,0 @@ -error: generic parameters may not be used in const operations - --> $DIR/dependence_lint.rs:14:32 - | -LL | let _: [u8; size_of::<*mut T>()]; // error on stable, error with gce - | ^ cannot perform const operation using `T` - | - = note: type parameters may not be used in const expressions - = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions - -error: generic parameters may not be used in const operations - --> $DIR/dependence_lint.rs:21:37 - | -LL | let _: [u8; if true { size_of::() } else { 3 }]; // error on stable, error with gce - | ^ cannot perform const operation using `T` - | - = note: type parameters may not be used in const expressions - = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions - -warning: cannot use constants which depend on generic parameters in types - --> $DIR/dependence_lint.rs:10:9 - | -LL | [0; size_of::<*mut T>()]; // lint on stable, error with `generic_const_exprs` - | ^^^^^^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #76200 - = note: `#[warn(const_evaluatable_unchecked)]` on by default - -warning: cannot use constants which depend on generic parameters in types - --> $DIR/dependence_lint.rs:17:9 - | -LL | [0; if false { size_of::() } else { 3 }]; // lint on stable, error with gce - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #76200 - -error: aborting due to 2 previous errors; 2 warnings emitted - diff --git a/src/test/ui/const-generics/generic_const_exprs/dependence_lint.gce.stderr b/src/test/ui/const-generics/generic_const_exprs/dependence_lint.gce.stderr deleted file mode 100644 index 74111ef1d..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/dependence_lint.gce.stderr +++ /dev/null @@ -1,34 +0,0 @@ -error: overly complex generic constant - --> $DIR/dependence_lint.rs:17:9 - | -LL | [0; if false { size_of::() } else { 3 }]; // lint on stable, error with gce - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ control flow is not supported in generic constants - | - = help: consider moving this anonymous constant into a `const` function - -error: overly complex generic constant - --> $DIR/dependence_lint.rs:21:17 - | -LL | let _: [u8; if true { size_of::() } else { 3 }]; // error on stable, error with gce - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ control flow is not supported in generic constants - | - = help: consider moving this anonymous constant into a `const` function - -error: unconstrained generic constant - --> $DIR/dependence_lint.rs:14:12 - | -LL | let _: [u8; size_of::<*mut T>()]; // error on stable, error with gce - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); size_of::<*mut T>()]:` - -error: unconstrained generic constant - --> $DIR/dependence_lint.rs:10:9 - | -LL | [0; size_of::<*mut T>()]; // lint on stable, error with `generic_const_exprs` - | ^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); size_of::<*mut T>()]:` - -error: aborting due to 4 previous errors - diff --git a/src/test/ui/const-generics/generic_const_exprs/dependence_lint.rs b/src/test/ui/const-generics/generic_const_exprs/dependence_lint.rs deleted file mode 100644 index b715e07f8..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/dependence_lint.rs +++ /dev/null @@ -1,26 +0,0 @@ -// revisions: full gce -// compile-flags: -Zdeduplicate-diagnostics=yes - -#![cfg_attr(gce, feature(generic_const_exprs))] -#![allow(incomplete_features)] - -use std::mem::size_of; - -fn foo() { - [0; size_of::<*mut T>()]; // lint on stable, error with `generic_const_exprs` - //[gce]~^ ERROR unconstrained - //[full]~^^ WARNING cannot use constants - //[full]~| WARNING this was previously accepted - let _: [u8; size_of::<*mut T>()]; // error on stable, error with gce - //[full]~^ ERROR generic parameters may not be used - //[gce]~^^ ERROR unconstrained generic - [0; if false { size_of::() } else { 3 }]; // lint on stable, error with gce - //[gce]~^ ERROR overly complex - //[full]~^^ WARNING cannot use constants - //[full]~| WARNING this was previously accepted - let _: [u8; if true { size_of::() } else { 3 }]; // error on stable, error with gce - //[full]~^ ERROR generic parameters may not be used - //[gce]~^^ ERROR overly complex -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/different-fn.rs b/src/test/ui/const-generics/generic_const_exprs/different-fn.rs deleted file mode 100644 index e8bc703bd..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/different-fn.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -use std::mem::size_of; -use std::marker::PhantomData; - -struct Foo(PhantomData); - -fn test() -> [u8; size_of::()] { - [0; size_of::>()] - //~^ ERROR unconstrained generic constant - //~| ERROR mismatched types -} - -fn main() { - test::(); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/different-fn.stderr b/src/test/ui/const-generics/generic_const_exprs/different-fn.stderr deleted file mode 100644 index 83a2f3740..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/different-fn.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/different-fn.rs:10:5 - | -LL | [0; size_of::>()] - | ^^^^^^^^^^^^^^^^^^^^^^^^ expected `size_of::()`, found `size_of::>()` - | - = note: expected constant `size_of::()` - found constant `size_of::>()` - -error: unconstrained generic constant - --> $DIR/different-fn.rs:10:9 - | -LL | [0; size_of::>()] - | ^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); size_of::>()]:` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/generic_const_exprs/division.rs b/src/test/ui/const-generics/generic_const_exprs/division.rs deleted file mode 100644 index 098fa9e04..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/division.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -fn with_bound() where [u8; N / 2]: Sized { - let _: [u8; N / 2] = [0; N / 2]; -} - -fn main() { - with_bound::<4>(); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/dont-eagerly-error-in-is-const-evaluatable.rs b/src/test/ui/const-generics/generic_const_exprs/dont-eagerly-error-in-is-const-evaluatable.rs deleted file mode 100644 index 3543960c3..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/dont-eagerly-error-in-is-const-evaluatable.rs +++ /dev/null @@ -1,16 +0,0 @@ -// run-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -// This test is a repro for #82279. It checks that we don't error -// when calling is_const_evaluatable on `std::mem::size_of::()` -// when looking for candidates that may prove `T: Foo` in `foo` - -trait Foo {} - -#[allow(dead_code)] -fn foo() {} - -impl Foo for T where [(); std::mem::size_of::()]: {} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/drop_impl.rs b/src/test/ui/const-generics/generic_const_exprs/drop_impl.rs deleted file mode 100644 index 077f77aa0..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/drop_impl.rs +++ /dev/null @@ -1,16 +0,0 @@ -//check-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -struct Foo -where - [(); N + 1]: ; - -impl Drop for Foo -where - [(); N + 1]: , -{ - fn drop(&mut self) {} -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/elaborate-trait-pred.rs b/src/test/ui/const-generics/generic_const_exprs/elaborate-trait-pred.rs deleted file mode 100644 index e4111157e..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/elaborate-trait-pred.rs +++ /dev/null @@ -1,24 +0,0 @@ -// run-pass -// Test that we use the elaborated predicates from traits -// to satisfy const evaluatable predicates. -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] -use std::mem::size_of; - -trait Foo: Sized -where - [(); size_of::()]: Sized, -{ -} - -impl Foo for u64 {} -impl Foo for u32 {} - -fn foo() -> [u8; size_of::()] { - [0; size_of::()] -} - -fn main() { - assert_eq!(foo::(), [0; 4]); - assert_eq!(foo::(), [0; 8]); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/eval-privacy.rs b/src/test/ui/const-generics/generic_const_exprs/eval-privacy.rs deleted file mode 100644 index 8023b998a..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/eval-privacy.rs +++ /dev/null @@ -1,26 +0,0 @@ -#![crate_type = "lib"] -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -pub struct Const; - -pub trait Trait { - type AssocTy; - fn assoc_fn() -> Self::AssocTy; -} - -impl Trait for Const // OK, trait impl predicates -where - Const<{ my_const_fn(U) }>: , -{ - type AssocTy = Const<{ my_const_fn(U) }>; - //~^ ERROR private type - fn assoc_fn() -> Self::AssocTy { - Const - } -} - -const fn my_const_fn(val: u8) -> u8 { - // body of this function doesn't matter - val -} diff --git a/src/test/ui/const-generics/generic_const_exprs/eval-privacy.stderr b/src/test/ui/const-generics/generic_const_exprs/eval-privacy.stderr deleted file mode 100644 index 2d9de8805..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/eval-privacy.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0446]: private type `fn(u8) -> u8 {my_const_fn}` in public interface - --> $DIR/eval-privacy.rs:16:5 - | -LL | type AssocTy = Const<{ my_const_fn(U) }>; - | ^^^^^^^^^^^^ can't leak private type -... -LL | const fn my_const_fn(val: u8) -> u8 { - | ----------------------------------- `fn(u8) -> u8 {my_const_fn}` declared as private - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0446`. diff --git a/src/test/ui/const-generics/generic_const_exprs/eval-try-unify.rs b/src/test/ui/const-generics/generic_const_exprs/eval-try-unify.rs deleted file mode 100644 index c59d62e57..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/eval-try-unify.rs +++ /dev/null @@ -1,26 +0,0 @@ -// build-pass - -#![feature(generic_const_exprs)] -//~^ WARNING the feature `generic_const_exprs` is incomplete - -trait Generic { - const ASSOC: usize; -} - -impl Generic for u8 { - const ASSOC: usize = 17; -} -impl Generic for u16 { - const ASSOC: usize = 13; -} - - -fn uses_assoc_type() -> [u8; N + T::ASSOC] { - [0; N + T::ASSOC] -} - -fn only_generic_n() -> [u8; N + 13] { - uses_assoc_type::() -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/eval-try-unify.stderr b/src/test/ui/const-generics/generic_const_exprs/eval-try-unify.stderr deleted file mode 100644 index 8eb1fccc5..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/eval-try-unify.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/eval-try-unify.rs:3:12 - | -LL | #![feature(generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/generic_const_exprs/evaluated-to-ambig.rs b/src/test/ui/const-generics/generic_const_exprs/evaluated-to-ambig.rs deleted file mode 100644 index 340e35e1c..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/evaluated-to-ambig.rs +++ /dev/null @@ -1,22 +0,0 @@ -// check-pass - -// We previously always returned ambiguity when equating generic consts, even if they -// only contain generic parameters. This is incorrect as trying to unify `N > 1` with `M > 1` -// should fail. -#![allow(incomplete_features)] -#![feature(generic_const_exprs)] - -enum Assert {} -trait IsTrue {} -impl IsTrue for Assert {} - -struct Foo; -trait Bar {} -impl Bar for Foo -where - Assert<{ N > 1 }>: IsTrue, - Assert<{ M > 1 }>: IsTrue, -{ -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/feature-gate-generic_const_exprs.rs b/src/test/ui/const-generics/generic_const_exprs/feature-gate-generic_const_exprs.rs deleted file mode 100644 index 10ab2fd86..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/feature-gate-generic_const_exprs.rs +++ /dev/null @@ -1,11 +0,0 @@ -type Arr = [u8; N - 1]; -//~^ ERROR generic parameters may not be used in const operations - -fn test() -> Arr where Arr: Default { - Default::default() -} - -fn main() { - let x = test::<33>(); - assert_eq!(x, [0; 32]); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/feature-gate-generic_const_exprs.stderr b/src/test/ui/const-generics/generic_const_exprs/feature-gate-generic_const_exprs.stderr deleted file mode 100644 index 2d60ebaa8..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/feature-gate-generic_const_exprs.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: generic parameters may not be used in const operations - --> $DIR/feature-gate-generic_const_exprs.rs:1:33 - | -LL | type Arr = [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(generic_const_exprs)]` to allow generic const expressions - -error: aborting due to previous error - diff --git a/src/test/ui/const-generics/generic_const_exprs/fn_call.rs b/src/test/ui/const-generics/generic_const_exprs/fn_call.rs deleted file mode 100644 index cbe4277df..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/fn_call.rs +++ /dev/null @@ -1,30 +0,0 @@ -// run-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -const fn test_me(a: usize, b: usize) -> usize { - if a < b { - std::mem::size_of::() - } else { - usize::MAX - } -} - -fn test_simple() -> [u8; std::mem::size_of::()] -where - [u8; std::mem::size_of::()]: Sized, -{ - [0; std::mem::size_of::()] -} - -fn test_with_args() -> [u8; test_me::(N, N + 1) + N] -where - [u8; test_me::(N, N + 1) + N]: Sized, -{ - [0; test_me::(N, N + 1) + N] -} - -fn main() { - assert_eq!([0; 8], test_simple::()); - assert_eq!([0; 12], test_with_args::()); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/from-sig-fail.rs b/src/test/ui/const-generics/generic_const_exprs/from-sig-fail.rs deleted file mode 100644 index b8f9827ec..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/from-sig-fail.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -fn test() -> [u8; N - 1] { - //~^ ERROR evaluation of `test::<0>::{constant#0}` failed - todo!() -} - -fn main() { - test::<0>(); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/from-sig-fail.stderr b/src/test/ui/const-generics/generic_const_exprs/from-sig-fail.stderr deleted file mode 100644 index bd71b49ee..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/from-sig-fail.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0080]: evaluation of `test::<0>::{constant#0}` failed - --> $DIR/from-sig-fail.rs:4:35 - | -LL | fn test() -> [u8; N - 1] { - | ^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/const-generics/generic_const_exprs/from-sig.rs b/src/test/ui/const-generics/generic_const_exprs/from-sig.rs deleted file mode 100644 index 28de4f864..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/from-sig.rs +++ /dev/null @@ -1,14 +0,0 @@ -// run-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -struct Foo; - -fn test() -> Foo<{ N > 10 }> { - Foo -} - -fn main() { - let _: Foo = test::<12>(); - let _: Foo = test::<9>(); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/function-call.rs b/src/test/ui/const-generics/generic_const_exprs/function-call.rs deleted file mode 100644 index 3c866333d..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/function-call.rs +++ /dev/null @@ -1,20 +0,0 @@ -// check-pass -// compile-flags: -Zdeduplicate-diagnostics=yes - -const fn foo() -> usize { - // We might instead branch on `std::mem::size_of::<*mut T>() < 8` here, - // which would cause this function to fail on 32 bit systems. - if false { - std::mem::size_of::() - } else { - 8 - } -} - -fn test() { - let _ = [0; foo::()]; - //~^ WARN cannot use constants which depend on generic parameters in types - //~| WARN this was previously accepted by the compiler but is being phased out -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/function-call.stderr b/src/test/ui/const-generics/generic_const_exprs/function-call.stderr deleted file mode 100644 index 84abfe578..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/function-call.stderr +++ /dev/null @@ -1,12 +0,0 @@ -warning: cannot use constants which depend on generic parameters in types - --> $DIR/function-call.rs:15:17 - | -LL | let _ = [0; foo::()]; - | ^^^^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #76200 - = note: `#[warn(const_evaluatable_unchecked)]` on by default - -warning: 1 warning emitted - diff --git a/src/test/ui/const-generics/generic_const_exprs/impl-bounds.rs b/src/test/ui/const-generics/generic_const_exprs/impl-bounds.rs deleted file mode 100644 index 7120d6ee2..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/impl-bounds.rs +++ /dev/null @@ -1,25 +0,0 @@ -// check-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -use std::mem::size_of; - -struct Foo(T); - -impl Foo() }> { - fn test() { - let _: [u8; std::mem::size_of::()]; - } -} - -trait Bar { - fn test_me(); -} - -impl Bar<{ size_of::() }> for Foo { - fn test_me() { - let _: [u8; std::mem::size_of::()]; - } -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/infer-too-generic.rs b/src/test/ui/const-generics/generic_const_exprs/infer-too-generic.rs deleted file mode 100644 index b8058c252..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/infer-too-generic.rs +++ /dev/null @@ -1,24 +0,0 @@ -// run-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -use std::{mem, ptr}; - -fn split_first(arr: [T; N]) -> (T, [T; N - 1]) -where - [T; N - 1]: Sized, -{ - let arr = mem::ManuallyDrop::new(arr); - unsafe { - let head = ptr::read(&arr[0]); - let tail = ptr::read(&arr[1..] as *const [T] as *const [T; N - 1]); - (head, tail) - } -} - -fn main() { - let arr = [0, 1, 2, 3, 4]; - let (head, tail) = split_first(arr); - assert_eq!(head, 0); - assert_eq!(tail, [1, 2, 3, 4]); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-100217.rs b/src/test/ui/const-generics/generic_const_exprs/issue-100217.rs deleted file mode 100644 index acdc348a3..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-100217.rs +++ /dev/null @@ -1,42 +0,0 @@ -// build-pass - -#![allow(incomplete_features)] -#![feature(generic_const_exprs)] - -trait TraitOne { - const MY_NUM: usize; - type MyErr: std::fmt::Debug; - - fn do_one_stuff(arr: [u8; Self::MY_NUM]) -> Result<(), Self::MyErr>; -} - -trait TraitTwo { - fn do_two_stuff(); -} - -impl TraitTwo for O -where - [(); Self::MY_NUM]:, -{ - fn do_two_stuff() { - O::do_one_stuff([5; Self::MY_NUM]).unwrap() - } -} - -struct Blargotron; - -#[derive(Debug)] -struct ErrTy([(); N]); - -impl TraitOne for Blargotron { - const MY_NUM: usize = 3; - type MyErr = ErrTy<{ Self::MY_NUM }>; - - fn do_one_stuff(_arr: [u8; Self::MY_NUM]) -> Result<(), Self::MyErr> { - Ok(()) - } -} - -fn main() { - Blargotron::do_two_stuff(); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-100360.rs b/src/test/ui/const-generics/generic_const_exprs/issue-100360.rs deleted file mode 100644 index 5572f1f88..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-100360.rs +++ /dev/null @@ -1,13 +0,0 @@ -// check-pass -// (this requires debug assertions) - -#![feature(adt_const_params)] -#![allow(incomplete_features)] - -fn foo(arg: &'static bool) -> bool { - B == arg -} - -fn main() { - foo::<{ &true }>(&false); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-102074.rs b/src/test/ui/const-generics/generic_const_exprs/issue-102074.rs deleted file mode 100644 index 66d15cf12..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-102074.rs +++ /dev/null @@ -1,23 +0,0 @@ -// check-pass -// Checks that the NoopMethodCall lint doesn't call Instance::resolve on unresolved consts - -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -#[derive(Debug, Clone)] -pub struct Aes128CipherKey([u8; Aes128Cipher::KEY_LEN]); - -impl Aes128CipherKey { - pub fn new(key: &[u8; Aes128Cipher::KEY_LEN]) -> Self { - Self(key.clone()) - } -} - -#[derive(Debug, Clone)] -pub struct Aes128Cipher; - -impl Aes128Cipher { - const KEY_LEN: usize = 16; -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-102768.rs b/src/test/ui/const-generics/generic_const_exprs/issue-102768.rs deleted file mode 100644 index 7aea0d30d..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-102768.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait X { - type Y<'a>; -} - -const _: () = { - fn f2<'a>(arg: Box = &'a ()>>) {} - //~^ ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments - //~| ERROR this associated type takes 0 generic arguments but 1 generic argument -}; - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-102768.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-102768.stderr deleted file mode 100644 index 8278edabe..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-102768.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied - --> $DIR/issue-102768.rs:9:30 - | -LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | ^ expected 1 lifetime argument - | -note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-102768.rs:5:10 - | -LL | type Y<'a>; - | ^ -- -help: add missing lifetime argument - | -LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | +++ - -error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/issue-102768.rs:9:30 - | -LL | fn f2<'a>(arg: Box = &'a ()>>) {} - | ^--- help: remove these generics - | | - | expected 0 generic arguments - | -note: associated type defined here, with 0 generic parameters - --> $DIR/issue-102768.rs:5:10 - | -LL | type Y<'a>; - | ^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-62504.full.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-62504.full.stderr deleted file mode 100644 index 0742db398..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-62504.full.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-62504.rs:18:21 - | -LL | ArrayHolder([0; Self::SIZE]) - | ^^^^^^^^^^^^^^^ expected `X`, found `Self::SIZE` - | - = note: expected constant `X` - found constant `Self::SIZE` - -error: unconstrained generic constant - --> $DIR/issue-62504.rs:18:25 - | -LL | ArrayHolder([0; Self::SIZE]) - | ^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); Self::SIZE]:` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-62504.min.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-62504.min.stderr deleted file mode 100644 index 9bea4105d..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-62504.min.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error: constant expression depends on a generic parameter - --> $DIR/issue-62504.rs:18:25 - | -LL | ArrayHolder([0; Self::SIZE]) - | ^^^^^^^^^^ - | - = note: this may fail depending on what value the parameter takes - -error[E0308]: mismatched types - --> $DIR/issue-62504.rs:18:21 - | -LL | ArrayHolder([0; Self::SIZE]) - | ----------- ^^^^^^^^^^^^^^^ expected `X`, found `Self::SIZE` - | | - | arguments to this struct are incorrect - | - = note: expected array `[u32; X]` - found array `[u32; _]` -note: tuple struct defined here - --> $DIR/issue-62504.rs:14:8 - | -LL | struct ArrayHolder([u32; X]); - | ^^^^^^^^^^^ - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-62504.rs b/src/test/ui/const-generics/generic_const_exprs/issue-62504.rs deleted file mode 100644 index a97f4b8ff..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-62504.rs +++ /dev/null @@ -1,27 +0,0 @@ -// revisions: full min -#![allow(incomplete_features)] -#![cfg_attr(full, feature(generic_const_exprs))] -#![cfg_attr(full, allow(incomplete_features))] - -trait HasSize { - const SIZE: usize; -} - -impl HasSize for ArrayHolder { - const SIZE: usize = X; -} - -struct ArrayHolder([u32; X]); - -impl ArrayHolder { - pub const fn new() -> Self { - ArrayHolder([0; Self::SIZE]) - //~^ ERROR mismatched types - //[full]~^^ ERROR unconstrained generic constant - //[min]~^^^ ERROR constant expression depends on a generic parameter - } -} - -fn main() { - let mut array = ArrayHolder::new(); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-69654.rs b/src/test/ui/const-generics/generic_const_exprs/issue-69654.rs deleted file mode 100644 index 9b36699bb..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-69654.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait Bar {} -impl Bar for [u8; T] {} -//~^ ERROR expected value, found type parameter `T` - -struct Foo {} -impl Foo -where - [u8; N]: Bar<[(); N]>, -{ - fn foo() {} -} - -fn main() { - Foo::foo(); - //~^ ERROR the function or associated item -} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-69654.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-69654.stderr deleted file mode 100644 index c3e2f8e16..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-69654.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error[E0423]: expected value, found type parameter `T` - --> $DIR/issue-69654.rs:5:25 - | -LL | impl Bar for [u8; T] {} - | - ^ not a value - | | - | found this type parameter - -error[E0599]: the function or associated item `foo` exists for struct `Foo<_>`, but its trait bounds were not satisfied - --> $DIR/issue-69654.rs:17:10 - | -LL | struct Foo {} - | -------------------------- function or associated item `foo` not found for this struct -... -LL | Foo::foo(); - | ^^^ function or associated item cannot be called on `Foo<_>` due to unsatisfied trait bounds - | - = note: the following trait bounds were not satisfied: - `[u8; _]: Bar<[(); _]>` - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0423, E0599. -For more information about an error, try `rustc --explain E0423`. diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr deleted file mode 100644 index 4d0d0253f..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-72787.min.stderr +++ /dev/null @@ -1,55 +0,0 @@ -error: generic parameters may not be used in const operations - --> $DIR/issue-72787.rs:11:17 - | -LL | Condition<{ LHS <= RHS }>: True - | ^^^ cannot perform const operation using `LHS` - | - = help: const parameters may only be used as standalone arguments, i.e. `LHS` - = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions - -error: generic parameters may not be used in const operations - --> $DIR/issue-72787.rs:11:24 - | -LL | Condition<{ LHS <= RHS }>: True - | ^^^ cannot perform const operation using `RHS` - | - = help: const parameters may only be used as standalone arguments, i.e. `RHS` - = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions - -error: generic parameters may not be used in const operations - --> $DIR/issue-72787.rs:25:25 - | -LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, - | ^ cannot perform const operation using `I` - | - = help: const parameters may only be used as standalone arguments, i.e. `I` - = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions - -error: generic parameters may not be used in const operations - --> $DIR/issue-72787.rs:25:36 - | -LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, - | ^ cannot perform const operation using `J` - | - = help: const parameters may only be used as standalone arguments, i.e. `J` - = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions - -error[E0283]: type annotations needed: cannot satisfy `IsLessOrEqual: True` - --> $DIR/issue-72787.rs:21:26 - | -LL | IsLessOrEqual: True, - | ^^^^ - | - = note: cannot satisfy `IsLessOrEqual: True` - -error[E0283]: type annotations needed: cannot satisfy `IsLessOrEqual: True` - --> $DIR/issue-72787.rs:21:26 - | -LL | IsLessOrEqual: True, - | ^^^^ - | - = note: cannot satisfy `IsLessOrEqual: True` - -error: aborting due to 6 previous errors - -For more information about this error, try `rustc --explain E0283`. diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-72787.rs b/src/test/ui/const-generics/generic_const_exprs/issue-72787.rs deleted file mode 100644 index c651bf1c8..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-72787.rs +++ /dev/null @@ -1,35 +0,0 @@ -// [full] check-pass -// revisions: full min -#![cfg_attr(full, feature(generic_const_exprs))] -#![cfg_attr(full, allow(incomplete_features))] - -pub struct IsLessOrEqual; -pub struct Condition; -pub trait True {} - -impl True for IsLessOrEqual where - Condition<{ LHS <= RHS }>: True -//[min]~^ Error generic parameters may not be used in const operations -//[min]~| Error generic parameters may not be used in const operations -{ -} -impl True for Condition {} - -struct S; -impl S -where - IsLessOrEqual: True, -//[min]~^ Error type annotations needed -//[min]~| Error type annotations needed - IsLessOrEqual: True, - IsLessOrEqual<{ 8 - I }, { 8 - J }>: True, -//[min]~^ Error generic parameters may not be used in const operations -//[min]~| Error generic parameters may not be used in const operations - // Condition<{ 8 - I <= 8 - J }>: True, -{ - fn print() { - println!("I {} J {}", I, J); - } -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.full.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.full.stderr deleted file mode 100644 index f2fddfbfb..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.full.stderr +++ /dev/null @@ -1,35 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-72819-generic-in-const-eval.rs:20:12 - | -LL | let x: Arr<{usize::MAX}> = Arr {}; - | ^^^^^^^^^^^^^^^^^ expected `false`, found `true` - | - = note: expected constant `false` - found constant `true` -note: required by a bound in `Arr` - --> $DIR/issue-72819-generic-in-const-eval.rs:8:39 - | -LL | struct Arr - | --- required by a bound in this -LL | where Assert::<{N < usize::MAX / 2}>: IsTrue, - | ^^^^^^ required by this bound in `Arr` - -error[E0308]: mismatched types - --> $DIR/issue-72819-generic-in-const-eval.rs:20:32 - | -LL | let x: Arr<{usize::MAX}> = Arr {}; - | ^^^ expected `false`, found `true` - | - = note: expected constant `false` - found constant `true` -note: required by a bound in `Arr` - --> $DIR/issue-72819-generic-in-const-eval.rs:8:39 - | -LL | struct Arr - | --- required by a bound in this -LL | where Assert::<{N < usize::MAX / 2}>: IsTrue, - | ^^^^^^ required by this bound in `Arr` - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.min.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.min.stderr deleted file mode 100644 index 42671412f..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.min.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: generic parameters may not be used in const operations - --> $DIR/issue-72819-generic-in-const-eval.rs:8:17 - | -LL | where Assert::<{N < usize::MAX / 2}>: IsTrue, - | ^ cannot perform const operation using `N` - | - = help: const parameters may only be used as standalone arguments, i.e. `N` - = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions - -error: aborting due to previous error - diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.rs b/src/test/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.rs deleted file mode 100644 index 7a5aa9e47..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-72819-generic-in-const-eval.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Regression test for #72819: ICE due to failure in resolving the const generic in `Arr`'s type -// bounds. -// revisions: full min -#![cfg_attr(full, feature(generic_const_exprs))] -#![cfg_attr(full, allow(incomplete_features))] - -struct Arr -where Assert::<{N < usize::MAX / 2}>: IsTrue, -//[min]~^ ERROR generic parameters may not be used in const operations -{ -} - -enum Assert {} - -trait IsTrue {} - -impl IsTrue for Assert {} - -fn main() { - let x: Arr<{usize::MAX}> = Arr {}; - //[full]~^ ERROR mismatched types - //[full]~| ERROR mismatched types -} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-73298.rs b/src/test/ui/const-generics/generic_const_exprs/issue-73298.rs deleted file mode 100644 index 3c59e1b79..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-73298.rs +++ /dev/null @@ -1,23 +0,0 @@ -// build-pass - -#![allow(incomplete_features)] -#![feature(generic_const_exprs)] - -use std::convert::AsMut; -use std::default::Default; - -trait Foo: Sized { - type Baz: Default + AsMut<[u8]>; - fn bar() { - Self::Baz::default().as_mut(); - } -} - -impl Foo for () { - type Baz = [u8; 1 * 1]; - //type Baz = [u8; 1]; -} - -fn main() { - <() as Foo>::bar(); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-73899.rs b/src/test/ui/const-generics/generic_const_exprs/issue-73899.rs deleted file mode 100644 index d1ab1be04..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-73899.rs +++ /dev/null @@ -1,20 +0,0 @@ -// run-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait Foo {} - -impl Foo for [(); N] where Self: FooImpl<{ N == 0 }> {} - -trait FooImpl {} - -impl FooImpl<{ 0u8 == 0u8 }> for [(); 0] {} - -impl FooImpl<{ 0u8 != 0u8 }> for [(); N] {} - -fn foo(_v: T) {} - -fn main() { - foo([]); - foo([()]); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-74634.rs b/src/test/ui/const-generics/generic_const_exprs/issue-74634.rs deleted file mode 100644 index cd1f7a9da..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-74634.rs +++ /dev/null @@ -1,28 +0,0 @@ -// check-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait If {} -impl If for () {} - -trait IsZero { - type Answer; -} - -struct True; -struct False; - -impl IsZero for () -where (): If<{N == 0}> { - type Answer = True; -} - -trait Foobar {} - -impl Foobar for () -where (): IsZero {} - -impl Foobar for () -where (): IsZero {} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-74713.rs b/src/test/ui/const-generics/generic_const_exprs/issue-74713.rs deleted file mode 100644 index 0bcb997d9..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-74713.rs +++ /dev/null @@ -1,8 +0,0 @@ -fn bug<'a>() -where - [(); { //~ ERROR mismatched types - let _: &'a (); //~ ERROR a non-static lifetime is not allowed in a `const` - }]: -{} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-74713.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-74713.stderr deleted file mode 100644 index e7673df0a..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-74713.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0658]: a non-static lifetime is not allowed in a `const` - --> $DIR/issue-74713.rs:4:17 - | -LL | let _: &'a (); - | ^^ - | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable - -error[E0308]: mismatched types - --> $DIR/issue-74713.rs:3:10 - | -LL | [(); { - | __________^ -LL | | let _: &'a (); -LL | | }]: - | |_____^ expected `usize`, found `()` - -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0308, E0658. -For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-76595.rs b/src/test/ui/const-generics/generic_const_exprs/issue-76595.rs deleted file mode 100644 index faa8b3d10..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-76595.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -struct Bool; - -trait True {} - -impl True for Bool {} - -fn test() where Bool<{core::mem::size_of::() > 4}>: True { - todo!() -} - -fn main() { - test::<2>(); - //~^ ERROR this function takes 2 generic arguments -} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-76595.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-76595.stderr deleted file mode 100644 index c587a7e15..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-76595.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error[E0107]: this function takes 2 generic arguments but 1 generic argument was supplied - --> $DIR/issue-76595.rs:15:5 - | -LL | test::<2>(); - | ^^^^ - supplied 1 generic argument - | | - | expected 2 generic arguments - | -note: function defined here, with 2 generic parameters: `T`, `P` - --> $DIR/issue-76595.rs:10:4 - | -LL | fn test() where Bool<{core::mem::size_of::() > 4}>: True { - | ^^^^ - -------------- -help: add missing generic argument - | -LL | test::<2, P>(); - | +++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.rs b/src/test/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.rs deleted file mode 100644 index 2fa9a71fb..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -// This test is a minimized reproduction for #79518 where -// during error handling for the type mismatch we would try -// to evaluate std::mem::size_of:: causing an ICE - -trait Foo { - type Assoc: PartialEq; - const AssocInstance: Self::Assoc; - - fn foo() - where - [(); std::mem::size_of::()]: , - { - Self::AssocInstance == [(); std::mem::size_of::()]; - //~^ Error: mismatched types - } -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.stderr deleted file mode 100644 index c90774e94..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-79518-default_trait_method_normalization.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-79518-default_trait_method_normalization.rs:16:32 - | -LL | Self::AssocInstance == [(); std::mem::size_of::()]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected associated type, found array `[(); _]` - | - = note: expected associated type `::Assoc` - found array `[(); _]` - = help: consider constraining the associated type `::Assoc` to `[(); _]` or calling a method that returns `::Assoc` - = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-80561-incorrect-param-env.rs b/src/test/ui/const-generics/generic_const_exprs/issue-80561-incorrect-param-env.rs deleted file mode 100644 index 77d3c98da..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-80561-incorrect-param-env.rs +++ /dev/null @@ -1,24 +0,0 @@ -// check-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -// This tests that the correct `param_env` is used so that -// attempting to normalize `Self::N` does not cause an ICE. - -pub struct Foo; - -impl Foo { - pub fn foo() {} -} - -pub trait Bar { - const N: usize; - fn bar() - where - [(); Self::N]: , - { - Foo::<{ Self::N }>::foo(); - } -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-80742.rs b/src/test/ui/const-generics/generic_const_exprs/issue-80742.rs deleted file mode 100644 index 275f69953..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-80742.rs +++ /dev/null @@ -1,32 +0,0 @@ -// check-fail - -// This test used to cause an ICE in rustc_mir::interpret::step::eval_rvalue_into_place - -#![allow(incomplete_features)] -#![feature(generic_const_exprs)] - -use std::fmt::Debug; -use std::marker::PhantomData; -use std::mem::size_of; - -struct Inline -where - [u8; size_of::() + 1]: , -{ - _phantom: PhantomData, - buf: [u8; size_of::() + 1], -} - -impl Inline -where - [u8; size_of::() + 1]: , -{ - pub fn new(val: T) -> Inline { - todo!() - } -} - -fn main() { - let dst = Inline::::new(0); //~ ERROR - //~^ ERROR -} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-80742.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-80742.stderr deleted file mode 100644 index bf1b411ee..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-80742.stderr +++ /dev/null @@ -1,72 +0,0 @@ -error[E0080]: evaluation of `Inline::::{constant#0}` failed - --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | intrinsics::size_of::() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ size_of called on unsized type `dyn Debug` - | -note: inside `std::mem::size_of::` - --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | intrinsics::size_of::() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: inside `Inline::::{constant#0}` - --> $DIR/issue-80742.rs:22:10 - | -LL | [u8; size_of::() + 1]: , - | ^^^^^^^^^^^^^^ - -error[E0599]: the function or associated item `new` exists for struct `Inline`, but its trait bounds were not satisfied - --> $DIR/issue-80742.rs:30:36 - | -LL | struct Inline - | ---------------- function or associated item `new` not found for this struct -... -LL | let dst = Inline::::new(0); - | ^^^ function or associated item cannot be called on `Inline` due to unsatisfied trait bounds - | - ::: $SRC_DIR/core/src/fmt/mod.rs:LL:COL - | -LL | pub trait Debug { - | --------------- doesn't satisfy `dyn Debug: Sized` - | - = note: the following trait bounds were not satisfied: - `dyn Debug: Sized` - -error[E0080]: evaluation of `Inline::::{constant#0}` failed - --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | intrinsics::size_of::() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ size_of called on unsized type `dyn Debug` - | -note: inside `std::mem::size_of::` - --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | intrinsics::size_of::() - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: inside `Inline::::{constant#0}` - --> $DIR/issue-80742.rs:14:10 - | -LL | [u8; size_of::() + 1]: , - | ^^^^^^^^^^^^^^ - -error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time - --> $DIR/issue-80742.rs:30:15 - | -LL | let dst = Inline::::new(0); - | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `dyn Debug` -note: required by a bound in `Inline` - --> $DIR/issue-80742.rs:12:15 - | -LL | struct Inline - | ^ required by this bound in `Inline` -help: consider relaxing the implicit `Sized` restriction - | -LL | struct Inline - | ++++++++ - -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0080, E0277, E0599. -For more information about an error, try `rustc --explain E0080`. diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-82268.rs b/src/test/ui/const-generics/generic_const_exprs/issue-82268.rs deleted file mode 100644 index d08fc5beb..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-82268.rs +++ /dev/null @@ -1,73 +0,0 @@ -// build-pass - -#![allow(incomplete_features)] -#![feature(generic_const_exprs)] - -trait Collate { - type Pass; - type Fail; - - fn collate(self) -> (Self::Pass, Self::Fail); -} - -impl Collate for () { - type Pass = (); - type Fail = (); - - fn collate(self) -> ((), ()) { - ((), ()) - } -} - -trait CollateStep { - type Pass; - type Fail; - fn collate_step(x: X, prev: Prev) -> (Self::Pass, Self::Fail); -} - -impl CollateStep for () { - type Pass = (X, P); - type Fail = F; - - fn collate_step(x: X, (p, f): (P, F)) -> ((X, P), F) { - ((x, p), f) - } -} - -struct CollateOpImpl; -trait CollateOpStep { - type NextOp; - type Apply; -} - -impl CollateOpStep for CollateOpImpl -where - CollateOpImpl<{ MASK >> 1 }>: Sized, -{ - type NextOp = CollateOpImpl<{ MASK >> 1 }>; - type Apply = (); -} - -impl Collate for (H, T) -where - T: Collate, - Op::Apply: CollateStep, -{ - type Pass = >::Pass; - type Fail = >::Fail; - - fn collate(self) -> (Self::Pass, Self::Fail) { - >::collate_step(self.0, self.1.collate()) - } -} - -fn collate(x: X) -> (X::Pass, X::Fail) -where - X: Collate>, -{ - x.collate() -} - -fn main() { - dbg!(collate::<_, 5>(("Hello", (42, ('!', ()))))); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-83765.rs b/src/test/ui/const-generics/generic_const_exprs/issue-83765.rs deleted file mode 100644 index fac811d13..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-83765.rs +++ /dev/null @@ -1,38 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait TensorDimension { - const DIM: usize; -} - -trait TensorSize: TensorDimension { - fn size(&self) -> [usize; Self::DIM]; -} - -trait Broadcastable: TensorSize + Sized { - type Element; - fn lazy_updim(&self, size: [usize; NEWDIM]) {} -} - -struct BMap<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> { - reference: &'a T, - closure: F, -} - -impl<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> TensorDimension - for BMap<'a, R, T, F, DIM> -{ - const DIM: usize = DIM; -} -impl<'a, R, T: Broadcastable, F: Fn(T::Element) -> R, const DIM: usize> TensorSize - for BMap<'a, R, T, F, DIM> -{ - fn size(&self) -> [usize; DIM] { - //~^ ERROR: method not compatible with trait [E0308] - self.reference.size() - //~^ ERROR: unconstrained generic constant - //~| ERROR: mismatched types - } -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-83765.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-83765.stderr deleted file mode 100644 index b693023f1..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-83765.stderr +++ /dev/null @@ -1,34 +0,0 @@ -error[E0308]: method not compatible with trait - --> $DIR/issue-83765.rs:30:5 - | -LL | fn size(&self) -> [usize; DIM] { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Self::DIM`, found `DIM` - | - = note: expected constant `Self::DIM` - found constant `DIM` - -error: unconstrained generic constant - --> $DIR/issue-83765.rs:32:24 - | -LL | self.reference.size() - | ^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); Self::DIM]:` -note: required by a bound in `TensorSize::size` - --> $DIR/issue-83765.rs:9:31 - | -LL | fn size(&self) -> [usize; Self::DIM]; - | ^^^^^^^^^ required by this bound in `TensorSize::size` - -error[E0308]: mismatched types - --> $DIR/issue-83765.rs:32:9 - | -LL | self.reference.size() - | ^^^^^^^^^^^^^^^^^^^^^ expected `DIM`, found `Self::DIM` - | - = note: expected constant `DIM` - found constant `Self::DIM` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-83972.rs b/src/test/ui/const-generics/generic_const_exprs/issue-83972.rs deleted file mode 100644 index 0063719b8..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-83972.rs +++ /dev/null @@ -1,38 +0,0 @@ -// build-pass - -#![allow(incomplete_features)] -#![feature(generic_const_exprs)] - -pub trait Foo { - fn foo(&self); -} - -pub struct FooImpl; -impl Foo for FooImpl { - fn foo(&self) {} -} - -pub trait Bar: 'static { - type Foo: Foo; - fn get() -> &'static Self::Foo; -} - -struct BarImpl; -impl Bar for BarImpl { - type Foo = FooImpl< - { - { 4 } - }, - >; - fn get() -> &'static Self::Foo { - &FooImpl - } -} - -pub fn boom() { - B::get().foo(); -} - -fn main() { - boom::(); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-84408.rs b/src/test/ui/const-generics/generic_const_exprs/issue-84408.rs deleted file mode 100644 index fb2e5590d..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-84408.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Regression test for #84408. -// check-pass - -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait Melon { - fn new(arr: [i32; X]) -> Self; - fn change>(self) -> T; -} - -struct Foo([i32; 5]); -struct Bar([i32; A + B]) -where - [(); A + B]: ; - -impl Melon<5> for Foo { - fn new(arr: [i32; 5]) -> Self { - Foo(arr) - } - fn change>(self) -> T { - T::new(self.0) - } -} - -impl Melon<{ A + B }> for Bar -where - [(); A + B]: , -{ - fn new(arr: [i32; A + B]) -> Self { - Bar(arr) - } - fn change>(self) -> T { - T::new(self.0) - } -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-84669.rs b/src/test/ui/const-generics/generic_const_exprs/issue-84669.rs deleted file mode 100644 index 3933ff20a..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-84669.rs +++ /dev/null @@ -1,30 +0,0 @@ -// build-pass - -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait Foo { - type Output; - - fn foo() -> Self::Output; -} - -impl Foo for [u8; 3] { - type Output = [u8; 1 + 2]; - - fn foo() -> [u8; 3] { - [1u8; 3] - } -} - -fn bug() -where - [u8; N]: Foo, - <[u8; N] as Foo>::Output: AsRef<[u8]>, -{ - <[u8; N]>::foo().as_ref(); -} - -fn main() { - bug::<3>(); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-85848.rs b/src/test/ui/const-generics/generic_const_exprs/issue-85848.rs deleted file mode 100644 index 3a7f4c618..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-85848.rs +++ /dev/null @@ -1,32 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait _Contains { - const does_contain: bool; -} - -trait Contains {} - -trait Delegates {} - -impl Delegates for T where T: Contains {} - -const fn contains() -> bool -where - A: _Contains, -{ - A::does_contain -} - -impl Contains() }> for U where T: _Contains {} - -fn writes_to_path(cap: &C) { - writes_to_specific_path(&cap); - //~^ ERROR: the trait bound `(): _Contains<&C>` is not satisfied [E0277] - //~| ERROR: unconstrained generic constant - //~| ERROR: mismatched types [E0308] -} - -fn writes_to_specific_path>(cap: &C) {} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-85848.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-85848.stderr deleted file mode 100644 index 09bcb0860..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-85848.stderr +++ /dev/null @@ -1,63 +0,0 @@ -error[E0277]: the trait bound `(): _Contains<&C>` is not satisfied - --> $DIR/issue-85848.rs:24:29 - | -LL | writes_to_specific_path(&cap); - | ----------------------- ^^^^ the trait `_Contains<&C>` is not implemented for `()` - | | - | required by a bound introduced by this call - | - = help: the trait `Delegates` is implemented for `T` -note: required for `&C` to implement `Contains<(), true>` - --> $DIR/issue-85848.rs:21:12 - | -LL | impl Contains() }> for U where T: _Contains {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ -note: required for `&C` to implement `Delegates<()>` - --> $DIR/issue-85848.rs:12:12 - | -LL | impl Delegates for T where T: Contains {} - | ^^^^^^^^^^^^ ^ -note: required by a bound in `writes_to_specific_path` - --> $DIR/issue-85848.rs:30:31 - | -LL | fn writes_to_specific_path>(cap: &C) {} - | ^^^^^^^^^^^^^ required by this bound in `writes_to_specific_path` - -error: unconstrained generic constant - --> $DIR/issue-85848.rs:24:29 - | -LL | writes_to_specific_path(&cap); - | ----------------------- ^^^^ - | | - | required by a bound introduced by this call - | - = help: try adding a `where` bound using this expression: `where [(); { contains::() }]:` -note: required for `&C` to implement `Contains<(), true>` - --> $DIR/issue-85848.rs:21:12 - | -LL | impl Contains() }> for U where T: _Contains {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ -note: required for `&C` to implement `Delegates<()>` - --> $DIR/issue-85848.rs:12:12 - | -LL | impl Delegates for T where T: Contains {} - | ^^^^^^^^^^^^ ^ -note: required by a bound in `writes_to_specific_path` - --> $DIR/issue-85848.rs:30:31 - | -LL | fn writes_to_specific_path>(cap: &C) {} - | ^^^^^^^^^^^^^ required by this bound in `writes_to_specific_path` - -error[E0308]: mismatched types - --> $DIR/issue-85848.rs:24:5 - | -LL | writes_to_specific_path(&cap); - | ^^^^^^^^^^^^^^^^^^^^^^^ expected `true`, found `{ contains::() }` - | - = note: expected constant `true` - found constant `{ contains::() }` - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0277, E0308. -For more information about an error, try `rustc --explain E0277`. diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-86710.rs b/src/test/ui/const-generics/generic_const_exprs/issue-86710.rs deleted file mode 100644 index bdd8a21b3..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-86710.rs +++ /dev/null @@ -1,73 +0,0 @@ -// build-pass - -#![allow(incomplete_features)] -#![feature(generic_const_exprs)] - -use std::marker::PhantomData; - -fn main() { - let x = FooImpl::> { phantom: PhantomData }; - let _ = x.foo::>(); -} - -trait Foo -where - T: Bar, -{ - fn foo(&self) - where - T: Operation, - >::Output: Bar; -} - -struct FooImpl -where - T: Bar, -{ - phantom: PhantomData, -} - -impl Foo for FooImpl -where - T: Bar, -{ - fn foo(&self) - where - T: Operation, - >::Output: Bar, - { - <>::Output as Bar>::error_occurs_here(); - } -} - -trait Bar { - fn error_occurs_here(); -} - -struct BarImpl; - -impl Bar for BarImpl { - fn error_occurs_here() {} -} - -trait Operation { - type Output; -} - -//// Part-A: This causes error. -impl Operation> for BarImpl -where - BarImpl<{ N + M }>: Sized, -{ - type Output = BarImpl<{ N + M }>; -} - -//// Part-B: This doesn't cause error. -// impl Operation> for BarImpl { -// type Output = BarImpl; -// } - -//// Part-C: This also doesn't cause error. -// impl Operation> for BarImpl { -// type Output = BarImpl<{ M }>; -// } diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-89851.rs b/src/test/ui/const-generics/generic_const_exprs/issue-89851.rs deleted file mode 100644 index cde849d90..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-89851.rs +++ /dev/null @@ -1,12 +0,0 @@ -// check-pass -// (this requires debug assertions) - -#![feature(adt_const_params)] -#![allow(incomplete_features)] - -pub const BAR: () = ice::<"">(); -pub const fn ice() { - &10; -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-90847.rs b/src/test/ui/const-generics/generic_const_exprs/issue-90847.rs deleted file mode 100644 index ebc6fe141..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-90847.rs +++ /dev/null @@ -1,9 +0,0 @@ -// check-pass - -#![allow(incomplete_features)] -#![feature(generic_const_exprs)] -#![feature(adt_const_params)] - -struct Foo where [(); 0 + 0]: Sized; - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-94287.rs b/src/test/ui/const-generics/generic_const_exprs/issue-94287.rs deleted file mode 100644 index 643126a46..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-94287.rs +++ /dev/null @@ -1,10 +0,0 @@ -// aux-build:issue-94287-aux.rs -// build-fail - -extern crate issue_94287_aux; - -use std::str::FromStr; - -fn main() { - let _ = >::from_str(""); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-94287.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-94287.stderr deleted file mode 100644 index 7390a0077..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-94287.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error: failed to evaluate generic const expression - --> $DIR/auxiliary/issue-94287-aux.rs:15:8 - | -LL | If<{ FRAC <= 32 }>: True, - | ^^^^^^^^^^^^^^ - | - = note: the crate this constant originates from uses `#![feature(generic_const_exprs)]` -help: consider enabling this feature - --> $DIR/issue-94287.rs:1:1 - | -LL | #![feature(generic_const_exprs)] - | - -error: aborting due to previous error - diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs deleted file mode 100644 index 67e30232e..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs +++ /dev/null @@ -1,25 +0,0 @@ -// check-pass - -#![feature(adt_const_params, generic_const_exprs)] -//~^ WARN the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] -//~^^ WARN the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] - -pub struct Changes -where - [(); CHANGES.len()]:, -{ - changes: [usize; CHANGES.len()], -} - -impl Changes -where - [(); CHANGES.len()]:, -{ - pub const fn new() -> Self { - Self { - changes: [0; CHANGES.len()], - } - } -} - -pub fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr deleted file mode 100644 index 1cceaece7..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr +++ /dev/null @@ -1,19 +0,0 @@ -warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-97047-ice-1.rs:3:12 - | -LL | #![feature(adt_const_params, generic_const_exprs)] - | ^^^^^^^^^^^^^^^^ - | - = note: see issue #95174 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-97047-ice-1.rs:3:30 - | -LL | #![feature(adt_const_params, generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - -warning: 2 warnings emitted - diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs deleted file mode 100644 index 00568a089..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs +++ /dev/null @@ -1,23 +0,0 @@ -// check-pass - -#![feature(adt_const_params, generic_const_exprs)] -//~^ WARN the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] -//~^^ WARN the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] - -pub struct Changes -where - [(); CHANGES.len()]:, -{ - changes: [usize; CHANGES.len()], -} - -impl Changes -where - [(); CHANGES.len()]:, -{ - pub fn combine(&mut self, other: &Self) { - for _change in &self.changes {} - } -} - -pub fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr deleted file mode 100644 index 774e842bc..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr +++ /dev/null @@ -1,19 +0,0 @@ -warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-97047-ice-2.rs:3:12 - | -LL | #![feature(adt_const_params, generic_const_exprs)] - | ^^^^^^^^^^^^^^^^ - | - = note: see issue #95174 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-97047-ice-2.rs:3:30 - | -LL | #![feature(adt_const_params, generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - -warning: 2 warnings emitted - diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-99705.rs b/src/test/ui/const-generics/generic_const_exprs/issue-99705.rs deleted file mode 100644 index 75b57b621..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/issue-99705.rs +++ /dev/null @@ -1,33 +0,0 @@ -// check-pass -#![crate_type = "lib"] -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] -pub trait MyIterator { - type Output; -} - -pub trait Foo { - const ABC: usize; -} - -pub struct IteratorStruct{ - -} - -pub struct Bar { - pub data: [usize; N] -} - -impl MyIterator for IteratorStruct { - type Output = Bar; -} - -pub fn test1() -> impl MyIterator> where [(); T::ABC]: Sized { - IteratorStruct::<{T::ABC}>{} -} - -pub trait Baz{} -impl Baz for Bar {} -pub fn test2() -> impl MyIterator> where [(); T::ABC]: Sized { - IteratorStruct::<{T::ABC}>{} -} diff --git a/src/test/ui/const-generics/generic_const_exprs/less_than.rs b/src/test/ui/const-generics/generic_const_exprs/less_than.rs deleted file mode 100644 index 2e9af1bf4..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/less_than.rs +++ /dev/null @@ -1,14 +0,0 @@ -// run-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -struct Foo; - -fn test() -> Foo<{ N > 10 }> where Foo<{ N > 10 }>: Sized { - Foo -} - -fn main() { - let _: Foo = test::<12>(); - let _: Foo = test::<9>(); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/let-bindings.rs b/src/test/ui/const-generics/generic_const_exprs/let-bindings.rs deleted file mode 100644 index cd5d76dd9..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/let-bindings.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -// We do not yet want to support let-bindings in abstract consts, -// so this test should keep failing for now. -fn test() -> [u8; { let x = N; N + 1 }] where [u8; { let x = N; N + 1 }]: Default { - //~^ ERROR overly complex generic constant - //~| ERROR overly complex generic constant - Default::default() -} - -fn main() { - let x = test::<31>(); - assert_eq!(x, [0; 32]); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/let-bindings.stderr b/src/test/ui/const-generics/generic_const_exprs/let-bindings.stderr deleted file mode 100644 index 5ebb4c399..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/let-bindings.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: overly complex generic constant - --> $DIR/let-bindings.rs:6:68 - | -LL | fn test() -> [u8; { let x = N; N + 1 }] where [u8; { let x = N; N + 1 }]: Default { - | ^^^^^^^^^^^^^^^^^^^^ blocks are not supported in generic constant - | - = help: consider moving this anonymous constant into a `const` function - = note: this operation may be supported in the future - -error: overly complex generic constant - --> $DIR/let-bindings.rs:6:35 - | -LL | fn test() -> [u8; { let x = N; N + 1 }] where [u8; { let x = N; N + 1 }]: Default { - | ^^^^^^^^^^^^^^^^^^^^ blocks are not supported in generic constant - | - = help: consider moving this anonymous constant into a `const` function - = note: this operation may be supported in the future - -error: aborting due to 2 previous errors - diff --git a/src/test/ui/const-generics/generic_const_exprs/needs_where_clause.rs b/src/test/ui/const-generics/generic_const_exprs/needs_where_clause.rs deleted file mode 100644 index 2bd3c801f..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/needs_where_clause.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![crate_type = "lib"] -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -const fn complex_maths(n : usize) -> usize { - 2 * n + 1 -} - -struct Example { - a: [f32; N], - b: [f32; complex_maths::(N)], - //~^ ERROR unconstrained - c: T, -} diff --git a/src/test/ui/const-generics/generic_const_exprs/needs_where_clause.stderr b/src/test/ui/const-generics/generic_const_exprs/needs_where_clause.stderr deleted file mode 100644 index 7b41e39b7..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/needs_where_clause.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: unconstrained generic constant - --> $DIR/needs_where_clause.rs:11:6 - | -LL | b: [f32; complex_maths::(N)], - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); complex_maths::(N)]:` - -error: aborting due to previous error - diff --git a/src/test/ui/const-generics/generic_const_exprs/nested-abstract-consts-1.rs b/src/test/ui/const-generics/generic_const_exprs/nested-abstract-consts-1.rs deleted file mode 100644 index 7e5022817..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/nested-abstract-consts-1.rs +++ /dev/null @@ -1,24 +0,0 @@ -// run-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -fn callee() -> usize -where - [u8; M2 + 1]: Sized, -{ - M2 -} - -fn caller() -> usize -where - [u8; N1 + 1]: Sized, - [u8; (N1 + 1) + 1]: Sized, -{ - callee::<{ N1 + 1 }>() -} - -fn main() { - assert_eq!(caller::<4>(), 5); -} - -// Test that the ``(N1 + 1) + 1`` bound on ``caller`` satisfies the ``M2 + 1`` bound on ``callee`` diff --git a/src/test/ui/const-generics/generic_const_exprs/nested-abstract-consts-2.rs b/src/test/ui/const-generics/generic_const_exprs/nested-abstract-consts-2.rs deleted file mode 100644 index 769e3ae68..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/nested-abstract-consts-2.rs +++ /dev/null @@ -1,35 +0,0 @@ -// run-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -struct Generic; - -struct ConstU64; - -impl Generic -where - ConstU64<{ K - 1 }>: , -{ - fn foo(self) -> u64 { - K - } -} - -impl Generic -where - ConstU64<{ K - 1 }>: , - ConstU64<{ K + 1 }>: , - ConstU64<{ K + 1 - 1 }>: , -{ - fn bar(self) -> u64 { - let x: Generic<{ K + 1 }> = Generic; - x.foo() - } -} - -fn main() { - assert_eq!((Generic::<10>).bar(), 11); -} - -// Test that the ``ConstU64<{ K + 1 - 1}>`` bound on ``bar``'s impl block satisfies the -// ``ConstU64<{K - 1}>`` bound on ``foo``'s impl block diff --git a/src/test/ui/const-generics/generic_const_exprs/nested_uneval_unification-1.rs b/src/test/ui/const-generics/generic_const_exprs/nested_uneval_unification-1.rs deleted file mode 100644 index 316887e5e..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/nested_uneval_unification-1.rs +++ /dev/null @@ -1,34 +0,0 @@ -// run-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -fn zero_init() -> Substs1 -where - [u8; N + 1]: , -{ - Substs1([0; N + 1]) -} -struct Substs1([u8; N + 1]) -where - [(); N + 1]: ; - -fn substs2() -> Substs1<{ M * 2 }> -where - [(); { M * 2 } + 1]: , -{ - zero_init::<{ M * 2 }>() -} - -fn substs3() -> Substs1<{ (L - 1) * 2 }> -where - [(); (L - 1) * 2 + 1]: , -{ - substs2::<{ L - 1 }>() -} - -fn main() { - assert_eq!(substs3::<2>().0, [0; 3]); -} - -// Test that the ``{ (L - 1) * 2 + 1 }`` bound on ``substs3`` satisfies the -// ``{ N + 1 }`` bound on ``Substs1`` diff --git a/src/test/ui/const-generics/generic_const_exprs/nested_uneval_unification-2.rs b/src/test/ui/const-generics/generic_const_exprs/nested_uneval_unification-2.rs deleted file mode 100644 index d45a6465b..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/nested_uneval_unification-2.rs +++ /dev/null @@ -1,29 +0,0 @@ -// run-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features, unused_parens, unused_braces)] - -fn zero_init() -> Substs1<{ (N) }> -where - [u8; { (N) }]: , -{ - Substs1([0; { (N) }]) -} - -struct Substs1([u8; { (N) }]) -where - [(); { (N) }]: ; - -fn substs2() -> Substs1<{ (M) }> { - zero_init::<{ (M) }>() -} - -fn substs3() -> Substs1<{ (L) }> { - substs2::<{ (L) }>() -} - -fn main() { - assert_eq!(substs3::<2>().0, [0; 2]); -} - -// Test that the implicit ``{ (L) }`` bound on ``substs3`` satisfies the -// ``{ (N) }`` bound on ``Substs1`` diff --git a/src/test/ui/const-generics/generic_const_exprs/no_dependence.rs b/src/test/ui/const-generics/generic_const_exprs/no_dependence.rs deleted file mode 100644 index db8dc6ed4..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/no_dependence.rs +++ /dev/null @@ -1,13 +0,0 @@ -// check-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -fn two_args() -> [u8; M + 2] { - [0; M + 2] -} - -fn yay() -> [u8; 4] { - two_args::() // no lint -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/no_where_clause.rs b/src/test/ui/const-generics/generic_const_exprs/no_where_clause.rs deleted file mode 100644 index 9c5de0317..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/no_where_clause.rs +++ /dev/null @@ -1,29 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features, unused)] - -const fn complex_maths(n : usize) -> usize { - 2 * n + 1 -} - -pub struct Example { - a: [f32; N], - b: [f32; complex_maths(N)], - //~^ ERROR unconstrained generic -} - -impl Example { - pub fn new() -> Self { - Self { - a: [0.; N], - b: [0.; complex_maths(N)], - } - } -} - -impl Example<2> { - pub fn sum(&self) -> f32 { - self.a.iter().sum::() + self.b.iter().sum::() - } -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/no_where_clause.stderr b/src/test/ui/const-generics/generic_const_exprs/no_where_clause.stderr deleted file mode 100644 index 3e5c2f5ca..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/no_where_clause.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: unconstrained generic constant - --> $DIR/no_where_clause.rs:10:6 - | -LL | b: [f32; complex_maths(N)], - | ^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); complex_maths(N)]:` - -error: aborting due to previous error - diff --git a/src/test/ui/const-generics/generic_const_exprs/normed_to_param_is_evaluatable.rs b/src/test/ui/const-generics/generic_const_exprs/normed_to_param_is_evaluatable.rs deleted file mode 100644 index b37b354ae..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/normed_to_param_is_evaluatable.rs +++ /dev/null @@ -1,12 +0,0 @@ -// check-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features, unused_braces)] - -#[rustfmt::skip] -fn foo() { - bar::<{{{{{{ N }}}}}}>(); -} - -fn bar() {} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/object-safety-err-ret.rs b/src/test/ui/const-generics/generic_const_exprs/object-safety-err-ret.rs deleted file mode 100644 index 24d333aba..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/object-safety-err-ret.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - - -const fn bar() -> usize { 7 } - -trait Foo { - fn test(&self) -> [u8; bar::()]; -} - -impl Foo for () { - fn test(&self) -> [u8; bar::()] { - [0; bar::()] - } -} - -fn use_dyn(v: &dyn Foo) { //~ERROR the trait `Foo` cannot be made into an object - v.test(); -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr b/src/test/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr deleted file mode 100644 index 4e1d71f15..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/object-safety-err-ret.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0038]: the trait `Foo` cannot be made into an object - --> $DIR/object-safety-err-ret.rs:17:16 - | -LL | fn use_dyn(v: &dyn Foo) { - | ^^^^^^^ `Foo` cannot be made into an object - | -note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/object-safety-err-ret.rs:8:23 - | -LL | trait Foo { - | --- this trait cannot be made into an object... -LL | fn test(&self) -> [u8; bar::()]; - | ^^^^^^^^^^^^^^^^^^^ ...because method `test` references the `Self` type in its return type - = help: consider moving `test` to another trait - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0038`. diff --git a/src/test/ui/const-generics/generic_const_exprs/object-safety-err-where-bounds.rs b/src/test/ui/const-generics/generic_const_exprs/object-safety-err-where-bounds.rs deleted file mode 100644 index 42c1cc507..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/object-safety-err-where-bounds.rs +++ /dev/null @@ -1,22 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] -#![deny(where_clauses_object_safety)] - - -const fn bar() -> usize { 7 } - -trait Foo { - fn test(&self) where [u8; bar::()]: Sized; - //~^ ERROR the trait `Foo` cannot be made into an object - //~| WARN this was previously accepted by the compiler but is being phased out -} - -impl Foo for () { - fn test(&self) where [u8; bar::()]: Sized {} -} - -fn use_dyn(v: &dyn Foo) { - v.test(); -} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/object-safety-err-where-bounds.stderr b/src/test/ui/const-generics/generic_const_exprs/object-safety-err-where-bounds.stderr deleted file mode 100644 index 440cf457e..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/object-safety-err-where-bounds.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: the trait `Foo` cannot be made into an object - --> $DIR/object-safety-err-where-bounds.rs:9:8 - | -LL | fn test(&self) where [u8; bar::()]: Sized; - | ^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #51443 -note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit - --> $DIR/object-safety-err-where-bounds.rs:9:8 - | -LL | trait Foo { - | --- this trait cannot be made into an object... -LL | fn test(&self) where [u8; bar::()]: Sized; - | ^^^^ ...because method `test` references the `Self` type in its `where` clause - = help: consider moving `test` to another trait -note: the lint level is defined here - --> $DIR/object-safety-err-where-bounds.rs:3:9 - | -LL | #![deny(where_clauses_object_safety)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.rs b/src/test/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.rs deleted file mode 100644 index 79e9834b5..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait Foo { - fn test(&self) -> [u8; N + 1]; -} - -impl Foo for () { - fn test(&self) -> [u8; N + 1] { - [0; N + 1] - } -} - -fn use_dyn(v: &dyn Foo) where [u8; N + 1]: Sized { - assert_eq!(v.test(), [0; N + 1]); -} - -fn main() { - use_dyn(&()); - //~^ ERROR type annotations needed -} diff --git a/src/test/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.stderr b/src/test/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.stderr deleted file mode 100644 index 59e9fee1e..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/object-safety-ok-infer-err.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error[E0284]: type annotations needed - --> $DIR/object-safety-ok-infer-err.rs:19:5 - | -LL | use_dyn(&()); - | ^^^^^^^ cannot infer the value of the const parameter `N` declared on the function `use_dyn` - | -note: required by a bound in `use_dyn` - --> $DIR/object-safety-ok-infer-err.rs:14:55 - | -LL | fn use_dyn(v: &dyn Foo) where [u8; N + 1]: Sized { - | ^^^^^ required by this bound in `use_dyn` -help: consider specifying the generic argument - | -LL | use_dyn::(&()); - | +++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0284`. diff --git a/src/test/ui/const-generics/generic_const_exprs/object-safety-ok.rs b/src/test/ui/const-generics/generic_const_exprs/object-safety-ok.rs deleted file mode 100644 index f4c89f623..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/object-safety-ok.rs +++ /dev/null @@ -1,21 +0,0 @@ -// run-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait Foo { - fn test(&self) -> [u8; N + 1]; -} - -impl Foo for () { - fn test(&self) -> [u8; N + 1] { - [0; N + 1] - } -} - -fn use_dyn(v: &dyn Foo) where [u8; N + 1]: Sized { - assert_eq!(v.test(), [0; N + 1]); -} - -fn main() { - use_dyn::<3>(&()); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/obligation-cause.rs b/src/test/ui/const-generics/generic_const_exprs/obligation-cause.rs deleted file mode 100644 index e7c8e4f66..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/obligation-cause.rs +++ /dev/null @@ -1,24 +0,0 @@ -#![allow(incomplete_features)] -#![feature(generic_const_exprs)] - -trait True {} - -struct Is; - -impl True for Is {} - -fn g() -//~^ NOTE required by a bound in this -where - Is<{ std::mem::size_of::() == 0 }>: True, - //~^ NOTE required by a bound in `g` - //~| NOTE required by this bound in `g` -{ -} - -fn main() { - g::(); - //~^ ERROR mismatched types - //~| NOTE expected `false`, found `true` - //~| NOTE expected constant `false` -} diff --git a/src/test/ui/const-generics/generic_const_exprs/obligation-cause.stderr b/src/test/ui/const-generics/generic_const_exprs/obligation-cause.stderr deleted file mode 100644 index a253ec676..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/obligation-cause.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/obligation-cause.rs:20:5 - | -LL | g::(); - | ^^^^^^^^^^ expected `false`, found `true` - | - = note: expected constant `false` - found constant `true` -note: required by a bound in `g` - --> $DIR/obligation-cause.rs:13:44 - | -LL | fn g() - | - required by a bound in this -... -LL | Is<{ std::mem::size_of::() == 0 }>: True, - | ^^^^ required by this bound in `g` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/generic_const_exprs/simple_fail.rs b/src/test/ui/const-generics/generic_const_exprs/simple_fail.rs deleted file mode 100644 index cae54df4c..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/simple_fail.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -type Arr = [u8; N - 1]; -//~^ ERROR evaluation of `Arr::<0>::{constant#0}` failed - -fn test() -> Arr -where - [u8; N - 1]: Sized, - //~^ ERROR evaluation of `test::<0>::{constant#0}` failed -{ - todo!() -} - -fn main() { - test::<0>(); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/simple_fail.stderr b/src/test/ui/const-generics/generic_const_exprs/simple_fail.stderr deleted file mode 100644 index a25fa56b7..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/simple_fail.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0080]: evaluation of `test::<0>::{constant#0}` failed - --> $DIR/simple_fail.rs:9:10 - | -LL | [u8; N - 1]: Sized, - | ^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow - -error[E0080]: evaluation of `Arr::<0>::{constant#0}` failed - --> $DIR/simple_fail.rs:4:33 - | -LL | type Arr = [u8; N - 1]; - | ^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/const-generics/generic_const_exprs/subexprs_are_const_evalutable.rs b/src/test/ui/const-generics/generic_const_exprs/subexprs_are_const_evalutable.rs deleted file mode 100644 index d6574a3aa..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/subexprs_are_const_evalutable.rs +++ /dev/null @@ -1,17 +0,0 @@ -// run-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -fn make_array() -> [(); M + 1] { - [(); M + 1] -} - -fn foo() -> [(); (N * 2) + 1] { - make_array::<{ N * 2 }>() -} - -fn main() { - assert_eq!(foo::<10>(), [(); 10 * 2 + 1]) -} - -// Tests that N * 2 is considered const_evalutable by appearing as part of the (N * 2) + 1 const diff --git a/src/test/ui/const-generics/generic_const_exprs/ty-alias-substitution.rs b/src/test/ui/const-generics/generic_const_exprs/ty-alias-substitution.rs deleted file mode 100644 index d058b3638..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/ty-alias-substitution.rs +++ /dev/null @@ -1,14 +0,0 @@ -// check-pass -// Test that we correctly substitute generic arguments for type aliases. -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -type Alias = [T; N + 1]; - -fn foo() -> Alias where [u8; M + 1]: Sized { - [0; M + 1] -} - -fn main() { - foo::<0>(); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs b/src/test/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs deleted file mode 100644 index c0404d35b..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs +++ /dev/null @@ -1,35 +0,0 @@ -#![feature(generic_const_exprs, adt_const_params, const_trait_impl)] -#![allow(incomplete_features)] - -// test `N + N` unifies with explicit function calls for non-builtin-types -#[derive(PartialEq, Eq)] -struct Foo(u8); - -impl const std::ops::Add for Foo { - type Output = Self; - - fn add(self, rhs: Self) -> Self::Output { - self - } -} - -struct Evaluatable; - -fn foo(a: Evaluatable<{ N + N }>) { - bar::<{ std::ops::Add::add(N, N) }>(); -} - -fn bar() {} - -// test that `N + N` unifies with explicit function calls for builin-types -struct Evaluatable2; - -fn foo2(a: Evaluatable2<{ N + N }>) { - bar2::<{ std::ops::Add::add(N, N) }>(); - //~^ error: unconstrained generic constant - // FIXME(generic_const_exprs) make this not an error -} - -fn bar2() {} - -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr b/src/test/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr deleted file mode 100644 index d18c7916f..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: unconstrained generic constant - --> $DIR/unify-op-with-fn-call.rs:28:12 - | -LL | bar2::<{ std::ops::Add::add(N, N) }>(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); { std::ops::Add::add(N, N) }]:` - -error: aborting due to previous error - diff --git a/src/test/ui/const-generics/generic_const_exprs/unop.rs b/src/test/ui/const-generics/generic_const_exprs/unop.rs deleted file mode 100644 index c12fef083..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/unop.rs +++ /dev/null @@ -1,14 +0,0 @@ -// run-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -struct Foo; - -fn test() -> Foo<{ !(N > 10) }> where Foo<{ !(N > 10) }>: Sized { - Foo -} - -fn main() { - let _: Foo = test::<12>(); - let _: Foo = test::<9>(); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/unused-complex-default-expr.rs b/src/test/ui/const-generics/generic_const_exprs/unused-complex-default-expr.rs deleted file mode 100644 index 9580f8a7f..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/unused-complex-default-expr.rs +++ /dev/null @@ -1,6 +0,0 @@ -// check-pass -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] -struct Foo; -struct Bar(Foo); -fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/unused_expr.rs b/src/test/ui/const-generics/generic_const_exprs/unused_expr.rs deleted file mode 100644 index c1bf19e0f..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/unused_expr.rs +++ /dev/null @@ -1,25 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -fn add() -> [u8; { N + 1; 5 }] { - //~^ ERROR overly complex generic constant - todo!() -} - -fn div() -> [u8; { N / 1; 5 }] { - //~^ ERROR overly complex generic constant - todo!() -} - -const fn foo(n: usize) {} - -fn fn_call() -> [u8; { foo(N); 5 }] { - //~^ ERROR overly complex generic constant - todo!() -} - -fn main() { - add::<12>(); - div::<9>(); - fn_call::<14>(); -} diff --git a/src/test/ui/const-generics/generic_const_exprs/unused_expr.stderr b/src/test/ui/const-generics/generic_const_exprs/unused_expr.stderr deleted file mode 100644 index df73acf53..000000000 --- a/src/test/ui/const-generics/generic_const_exprs/unused_expr.stderr +++ /dev/null @@ -1,29 +0,0 @@ -error: overly complex generic constant - --> $DIR/unused_expr.rs:4:34 - | -LL | fn add() -> [u8; { N + 1; 5 }] { - | ^^^^^^^^^^^^ blocks are not supported in generic constant - | - = help: consider moving this anonymous constant into a `const` function - = note: this operation may be supported in the future - -error: overly complex generic constant - --> $DIR/unused_expr.rs:9:34 - | -LL | fn div() -> [u8; { N / 1; 5 }] { - | ^^^^^^^^^^^^ blocks are not supported in generic constant - | - = help: consider moving this anonymous constant into a `const` function - = note: this operation may be supported in the future - -error: overly complex generic constant - --> $DIR/unused_expr.rs:16:38 - | -LL | fn fn_call() -> [u8; { foo(N); 5 }] { - | ^^^^^^^^^^^^^ blocks are not supported in generic constant - | - = help: consider moving this anonymous constant into a `const` function - = note: this operation may be supported in the future - -error: aborting due to 3 previous errors - -- cgit v1.2.3