Auto merge of #75322 - JulianKnodt:revisions, r=lcnr

Add a bunch of const-generic revisions for `min_const_generics`

This adds a bunch of revisions to `const-generic` tests which is part of #75279, but doesn't cover everything.

r? @lcnr
This commit is contained in:
bors 2020-08-13 10:31:57 +00:00
commit 1a7d9f52bc
155 changed files with 1325 additions and 853 deletions

View File

@ -1,7 +1,9 @@
// check-pass
// revisions: full min
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
trait Trait {}

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/apit-with-const-param.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -0,0 +1,18 @@
error: constant expression depends on a generic parameter
--> $DIR/array-size-in-generic-struct-param.rs:9:38
|
LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]);
| ^^^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: constant expression depends on a generic parameter
--> $DIR/array-size-in-generic-struct-param.rs:20:10
|
LL | arr: [u8; CFG.arr_size],
| ^^^^^^^^^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: aborting due to 2 previous errors

View File

@ -0,0 +1,27 @@
error: generic parameters must not be used inside of non trivial constant values
--> $DIR/array-size-in-generic-struct-param.rs:9:48
|
LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]);
| ^ non-trivial anonymous constants must not depend on the parameter `N`
|
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
error: generic parameters must not be used inside of non trivial constant values
--> $DIR/array-size-in-generic-struct-param.rs:20:15
|
LL | arr: [u8; CFG.arr_size],
| ^^^ non-trivial anonymous constants must not depend on the parameter `CFG`
|
= help: it is currently only allowed to use either `CFG` or `{ CFG }` as generic constants
error: using `Config` as const generic parameters is forbidden
--> $DIR/array-size-in-generic-struct-param.rs:18:21
|
LL | struct B<const CFG: Config> {
| ^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error: aborting due to 3 previous errors

View File

@ -1,9 +1,14 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// Tests that array sizes that depend on const-params are checked using `ConstEvaluatable`.
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
#[allow(dead_code)]
struct ArithArrayLen<const N: usize>([u32; 0 + N]);
//~^ ERROR constant expression depends on a generic parameter
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used inside of non trivial constant values
#[derive(PartialEq, Eq)]
struct Config {
@ -11,7 +16,10 @@ struct Config {
}
struct B<const CFG: Config> {
arr: [u8; CFG.arr_size], //~ ERROR constant expression depends on a generic parameter
//[min]~^ ERROR using `Config` as const generic parameters is forbidden
arr: [u8; CFG.arr_size],
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used inside of non trivial
}
const C: Config = Config { arr_size: 5 };

View File

@ -1,27 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/array-size-in-generic-struct-param.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error: constant expression depends on a generic parameter
--> $DIR/array-size-in-generic-struct-param.rs:5:38
|
LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]);
| ^^^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: constant expression depends on a generic parameter
--> $DIR/array-size-in-generic-struct-param.rs:14:10
|
LL | arr: [u8; CFG.arr_size],
| ^^^^^^^^^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: aborting due to 2 previous errors; 1 warning emitted

View File

@ -1,7 +1,9 @@
// run-pass
// revisions: full min
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
pub trait Foo {
fn foo(&self);

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/broken-mir-1.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -1,7 +1,9 @@
// run-pass
// revisions: full min
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
use std::fmt::Debug;

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/broken-mir-2.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -0,0 +1,11 @@
error[E0282]: type annotations needed
--> $DIR/cannot-infer-const-args.rs:12:5
|
LL | foo();
| ^^^
|
= note: unable to infer the value of a const parameter
error: aborting due to previous error
For more information about this error, try `rustc --explain E0282`.

View File

@ -0,0 +1,11 @@
error[E0282]: type annotations needed
--> $DIR/cannot-infer-const-args.rs:12:5
|
LL | foo();
| ^^^
|
= note: unable to infer the value of a const parameter
error: aborting due to previous error
For more information about this error, try `rustc --explain E0282`.

View File

@ -1,5 +1,8 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
fn foo<const X: usize>() -> usize {
0

View File

@ -1,20 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/cannot-infer-const-args.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error[E0282]: type annotations needed
--> $DIR/cannot-infer-const-args.rs:9:5
|
LL | foo();
| ^^^
|
= note: unable to infer the value of a const parameter
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0282`.

View File

@ -1,6 +1,9 @@
// run-pass
#![feature(const_generics)]
#![allow(incomplete_features)]
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
fn foo<const N: usize>(v: &[u8; N]) -> &[u8] {
v

View File

@ -1,8 +1,10 @@
// Test that a concrete const type i.e. A<2>, can be used as an argument type in a function
// run-pass
// revisions: full min
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
struct A<const N: usize>; // ok

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/concrete-const-as-fn-arg.rs:4:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -1,9 +1,11 @@
// Test that a method/associated non-method within an impl block of a concrete const type i.e. A<2>,
// is callable.
// run-pass
// revisions: full min
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
pub struct A<const N: u32>;

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/concrete-const-impl-method.rs:5:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -1,7 +1,10 @@
// Checks that `impl Trait<{anon_const}> for Type` evaluates successfully.
// run-pass
// revisions: full min
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
trait IsZeroTrait<const IS_ZERO: bool>{}

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/condition-in-trait-const-arg.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -1,7 +1,9 @@
// run-pass
// revisions: full min
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
fn const_u32_identity<const X: u32>() -> u32 {
X

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-arg-in-fn.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -1,7 +1,9 @@
// run-pass
// revisions: full
// FIXME(#75323) Omitted min revision for now due to ICE.
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![allow(dead_code)]
fn test<const N: usize>() {}

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-argument-non-static-lifetime.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -0,0 +1,8 @@
error: expected one of `,` or `>`, found `+`
--> $DIR/const-expression-parameter.rs:16:22
|
LL | i32_identity::<1 + 2>();
| ^ expected one of `,` or `>`
error: aborting due to previous error

View File

@ -0,0 +1,8 @@
error: expected one of `,` or `>`, found `+`
--> $DIR/const-expression-parameter.rs:16:22
|
LL | i32_identity::<1 + 2>();
| ^ expected one of `,` or `>`
error: aborting due to previous error

View File

@ -1,5 +1,8 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
fn i32_identity<const X: i32>() -> i32 {
5

View File

@ -1,17 +0,0 @@
error: expected one of `,` or `>`, found `+`
--> $DIR/const-expression-parameter.rs:13:22
|
LL | i32_identity::<1 + 2>();
| ^ expected one of `,` or `>`
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-expression-parameter.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error: aborting due to previous error; 1 warning emitted

View File

@ -1,6 +1,10 @@
// Checks that `const fn` with const params can be used.
// run-pass
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
const fn const_u32_identity<const X: u32>() -> u32 {
X

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-fn-with-const-param.rs:2:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -1,7 +1,9 @@
// run-pass
// revisions: full min
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
struct Foo<T, const N: usize>([T; N]);

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-generic-array-wrapper.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -1,7 +1,9 @@
// run-pass
// revisions: full min
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
#[derive(Debug)]
struct S<const N: usize>;

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-generic-type_name.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -1,7 +1,9 @@
// check-pass
// revisions: full min
#![allow(incomplete_features)]
#![feature(const_generics)]
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
struct Foo<const A: usize, const B: usize>;

View File

@ -1,42 +1,33 @@
error[E0637]: `&` without an explicit lifetime name cannot be used here
--> $DIR/const-param-elided-lifetime.rs:9:19
--> $DIR/const-param-elided-lifetime.rs:11:19
|
LL | struct A<const N: &u8>;
| ^ explicit lifetime name needed here
error[E0637]: `&` without an explicit lifetime name cannot be used here
--> $DIR/const-param-elided-lifetime.rs:13:15
--> $DIR/const-param-elided-lifetime.rs:16:15
|
LL | impl<const N: &u8> A<N> {
| ^ explicit lifetime name needed here
error[E0637]: `&` without an explicit lifetime name cannot be used here
--> $DIR/const-param-elided-lifetime.rs:14:21
--> $DIR/const-param-elided-lifetime.rs:19:21
|
LL | fn foo<const M: &u8>(&self) {}
| ^ explicit lifetime name needed here
error[E0637]: `&` without an explicit lifetime name cannot be used here
--> $DIR/const-param-elided-lifetime.rs:18:15
--> $DIR/const-param-elided-lifetime.rs:24:15
|
LL | impl<const N: &u8> B for A<N> {}
| ^ explicit lifetime name needed here
error[E0637]: `&` without an explicit lifetime name cannot be used here
--> $DIR/const-param-elided-lifetime.rs:21:17
--> $DIR/const-param-elided-lifetime.rs:28:17
|
LL | fn bar<const N: &u8>() {}
| ^ explicit lifetime name needed here
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-param-elided-lifetime.rs:6:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error: aborting due to 5 previous errors; 1 warning emitted
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0637`.

View File

@ -0,0 +1,78 @@
error[E0637]: `&` without an explicit lifetime name cannot be used here
--> $DIR/const-param-elided-lifetime.rs:11:19
|
LL | struct A<const N: &u8>;
| ^ explicit lifetime name needed here
error[E0637]: `&` without an explicit lifetime name cannot be used here
--> $DIR/const-param-elided-lifetime.rs:16:15
|
LL | impl<const N: &u8> A<N> {
| ^ explicit lifetime name needed here
error[E0637]: `&` without an explicit lifetime name cannot be used here
--> $DIR/const-param-elided-lifetime.rs:19:21
|
LL | fn foo<const M: &u8>(&self) {}
| ^ explicit lifetime name needed here
error[E0637]: `&` without an explicit lifetime name cannot be used here
--> $DIR/const-param-elided-lifetime.rs:24:15
|
LL | impl<const N: &u8> B for A<N> {}
| ^ explicit lifetime name needed here
error[E0637]: `&` without an explicit lifetime name cannot be used here
--> $DIR/const-param-elided-lifetime.rs:28:17
|
LL | fn bar<const N: &u8>() {}
| ^ explicit lifetime name needed here
error: using `&'static u8` as const generic parameters is forbidden
--> $DIR/const-param-elided-lifetime.rs:11:19
|
LL | struct A<const N: &u8>;
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error: using `&'static u8` as const generic parameters is forbidden
--> $DIR/const-param-elided-lifetime.rs:16:15
|
LL | impl<const N: &u8> A<N> {
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error: using `&'static u8` as const generic parameters is forbidden
--> $DIR/const-param-elided-lifetime.rs:24:15
|
LL | impl<const N: &u8> B for A<N> {}
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error: using `&'static u8` as const generic parameters is forbidden
--> $DIR/const-param-elided-lifetime.rs:28:17
|
LL | fn bar<const N: &u8>() {}
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error: using `&'static u8` as const generic parameters is forbidden
--> $DIR/const-param-elided-lifetime.rs:19:21
|
LL | fn foo<const M: &u8>(&self) {}
| ^^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0637`.

View File

@ -2,23 +2,31 @@
// behaviour of trait bounds where `fn foo<T: Ord<&u8>>() {}` is illegal. Though we could change
// elided lifetimes within the type of a const generic parameters to be 'static, like elided
// lifetimes within const/static items.
// revisions: full min
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
struct A<const N: &u8>;
//~^ ERROR `&` without an explicit lifetime name cannot be used here
//[min]~^^ ERROR using `&'static u8` as const generic parameters is forbidden
trait B {}
impl<const N: &u8> A<N> { //~ ERROR `&` without an explicit lifetime name cannot be used here
impl<const N: &u8> A<N> {
//~^ ERROR `&` without an explicit lifetime name cannot be used here
//[min]~^^ ERROR using `&'static u8` as const generic parameters is forbidden
fn foo<const M: &u8>(&self) {}
//~^ ERROR `&` without an explicit lifetime name cannot be used here
//[min]~^^ ERROR using `&'static u8` as const generic parameters is forbidden
}
impl<const N: &u8> B for A<N> {}
//~^ ERROR `&` without an explicit lifetime name cannot be used here
//[min]~^^ ERROR using `&'static u8` as const generic parameters is forbidden
fn bar<const N: &u8>() {}
//~^ ERROR `&` without an explicit lifetime name cannot be used here
//[min]~^^ ERROR using `&'static u8` as const generic parameters is forbidden
fn main() {}

View File

@ -0,0 +1,13 @@
error[E0401]: can't use generic parameters from outer function
--> $DIR/const-param-from-outer-fn.rs:9:9
|
LL | fn foo<const X: u32>() {
| - const parameter from outer function
LL | fn bar() -> u32 {
| --- try adding a local generic parameter in this method instead
LL | X
| ^ use of generic parameter from outer function
error: aborting due to previous error
For more information about this error, try `rustc --explain E0401`.

View File

@ -0,0 +1,13 @@
error[E0401]: can't use generic parameters from outer function
--> $DIR/const-param-from-outer-fn.rs:9:9
|
LL | fn foo<const X: u32>() {
| - const parameter from outer function
LL | fn bar() -> u32 {
| --- try adding a local generic parameter in this method instead
LL | X
| ^ use of generic parameter from outer function
error: aborting due to previous error
For more information about this error, try `rustc --explain E0401`.

View File

@ -1,5 +1,8 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
fn foo<const X: u32>() {
fn bar() -> u32 {

View File

@ -1,22 +0,0 @@
error[E0401]: can't use generic parameters from outer function
--> $DIR/const-param-from-outer-fn.rs:6:9
|
LL | fn foo<const X: u32>() {
| - const parameter from outer function
LL | fn bar() -> u32 {
| --- try adding a local generic parameter in this method instead
LL | X
| ^ use of generic parameter from outer function
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-param-from-outer-fn.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0401`.

View File

@ -1,8 +1,12 @@
// Check that const parameters are permitted in traits.
// run-pass
// revisions: full min
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
trait Trait<const T: ()> {}
trait Trait<const T: u8> {}
fn main() {}

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-param-in-trait.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -0,0 +1,15 @@
error[E0770]: the type of const parameters must not depend on other generic parameters
--> $DIR/const-param-type-depends-on-const-param.rs:12:52
|
LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
| ^ the type must not depend on the parameter `N`
error[E0770]: the type of const parameters must not depend on other generic parameters
--> $DIR/const-param-type-depends-on-const-param.rs:16:40
|
LL | pub struct SelfDependent<const N: [u8; N]>;
| ^ the type must not depend on the parameter `N`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0770`.

View File

@ -0,0 +1,33 @@
error[E0770]: the type of const parameters must not depend on other generic parameters
--> $DIR/const-param-type-depends-on-const-param.rs:12:52
|
LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
| ^ the type must not depend on the parameter `N`
error[E0770]: the type of const parameters must not depend on other generic parameters
--> $DIR/const-param-type-depends-on-const-param.rs:16:40
|
LL | pub struct SelfDependent<const N: [u8; N]>;
| ^ the type must not depend on the parameter `N`
error: using `[u8; _]` as const generic parameters is forbidden
--> $DIR/const-param-type-depends-on-const-param.rs:12:47
|
LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error: using `[u8; _]` as const generic parameters is forbidden
--> $DIR/const-param-type-depends-on-const-param.rs:16:35
|
LL | pub struct SelfDependent<const N: [u8; N]>;
| ^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0770`.

View File

@ -1,5 +1,8 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
// Currently, const parameters cannot depend on other generic parameters,
// as our current implementation can't really support this.
@ -8,8 +11,10 @@
pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
//~^ ERROR: the type of const parameters must not depend on other generic parameters
//[min]~^^ ERROR using `[u8; _]` as const generic parameters is forbidden
pub struct SelfDependent<const N: [u8; N]>;
//~^ ERROR: the type of const parameters must not depend on other generic parameters
//[min]~^^ ERROR using `[u8; _]` as const generic parameters is forbidden
fn main() {}

View File

@ -1,24 +0,0 @@
error[E0770]: the type of const parameters must not depend on other generic parameters
--> $DIR/const-param-type-depends-on-const-param.rs:9:52
|
LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
| ^ the type must not depend on the parameter `N`
error[E0770]: the type of const parameters must not depend on other generic parameters
--> $DIR/const-param-type-depends-on-const-param.rs:12:40
|
LL | pub struct SelfDependent<const N: [u8; N]>;
| ^ the type must not depend on the parameter `N`
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-param-type-depends-on-const-param.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0770`.

View File

@ -1,27 +1,18 @@
error[E0770]: the type of const parameters must not depend on other generic parameters
--> $DIR/const-param-type-depends-on-type-param.rs:9:34
--> $DIR/const-param-type-depends-on-type-param.rs:12:34
|
LL | pub struct Dependent<T, const X: T>([(); X]);
| ^ the type must not depend on the parameter `T`
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-param-type-depends-on-type-param.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error[E0392]: parameter `T` is never used
--> $DIR/const-param-type-depends-on-type-param.rs:9:22
--> $DIR/const-param-type-depends-on-type-param.rs:12:22
|
LL | pub struct Dependent<T, const X: T>([(); X]);
| ^ unused parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `std::marker::PhantomData`
error: aborting due to 2 previous errors; 1 warning emitted
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0392, E0770.
For more information about an error, try `rustc --explain E0392`.

View File

@ -0,0 +1,18 @@
error[E0770]: the type of const parameters must not depend on other generic parameters
--> $DIR/const-param-type-depends-on-type-param.rs:12:34
|
LL | pub struct Dependent<T, const X: T>([(); X]);
| ^ the type must not depend on the parameter `T`
error[E0392]: parameter `T` is never used
--> $DIR/const-param-type-depends-on-type-param.rs:12:22
|
LL | pub struct Dependent<T, const X: T>([(); X]);
| ^ unused parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `std::marker::PhantomData`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0392, E0770.
For more information about an error, try `rustc --explain E0392`.

View File

@ -1,5 +1,8 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
// Currently, const parameters cannot depend on other generic parameters,
// as our current implementation can't really support this.

View File

@ -0,0 +1,14 @@
error: const parameter `x` should have an upper case name
--> $DIR/const-parameter-uppercase-lint.rs:9:15
|
LL | fn noop<const x: u32>() {
| ^ help: convert the identifier to upper case (notice the capitalization): `X`
|
note: the lint level is defined here
--> $DIR/const-parameter-uppercase-lint.rs:7:9
|
LL | #![deny(non_upper_case_globals)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -0,0 +1,14 @@
error: const parameter `x` should have an upper case name
--> $DIR/const-parameter-uppercase-lint.rs:9:15
|
LL | fn noop<const x: u32>() {
| ^ help: convert the identifier to upper case (notice the capitalization): `X`
|
note: the lint level is defined here
--> $DIR/const-parameter-uppercase-lint.rs:7:9
|
LL | #![deny(non_upper_case_globals)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -1,5 +1,8 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
#![deny(non_upper_case_globals)]

View File

@ -1,23 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-parameter-uppercase-lint.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error: const parameter `x` should have an upper case name
--> $DIR/const-parameter-uppercase-lint.rs:6:15
|
LL | fn noop<const x: u32>() {
| ^ help: convert the identifier to upper case (notice the capitalization): `X`
|
note: the lint level is defined here
--> $DIR/const-parameter-uppercase-lint.rs:4:9
|
LL | #![deny(non_upper_case_globals)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error; 1 warning emitted

View File

@ -1,7 +1,10 @@
// Check that arrays can be used with generic const and type.
// run-pass
// revisions: full min
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
#![allow(dead_code, unused_variables)]

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/const-types.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -1,7 +1,10 @@
// Check that deriving debug on struct with const is permitted.
// run-pass
// revisions: full min
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
#[derive(Debug)]
struct X<const N: usize> {

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/derive-debug-array-wrapper.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -0,0 +1,12 @@
error[E0308]: mismatched types
--> $DIR/different_byref.rs:13:9
|
LL | x = Const::<{ [4] }> {};
| ^^^^^^^^^^^^^^^^^^^ expected `3_usize`, found `4_usize`
|
= note: expected type `[3_usize]`
found type `[4_usize]`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.

View File

@ -0,0 +1,11 @@
error: using `[usize; 1]` as const generic parameters is forbidden
--> $DIR/different_byref.rs:8:23
|
LL | struct Const<const V: [usize; 1]> {}
| ^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error: aborting due to previous error

View File

@ -1,11 +1,15 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// Check that different const types are different.
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
struct Const<const V: [usize; 1]> {}
//[min]~^ using `[usize; 1]` as const generic parameters is forbidden
fn main() {
let mut x = Const::<{ [3] }> {};
x = Const::<{ [4] }> {};
//~^ ERROR mismatched types
//[full]~^ ERROR mismatched types
}

View File

@ -1,21 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/different_byref.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error[E0308]: mismatched types
--> $DIR/different_byref.rs:8:9
|
LL | x = Const::<{ [4] }> {};
| ^^^^^^^^^^^^^^^^^^^ expected `3_usize`, found `4_usize`
|
= note: expected type `[3_usize]`
found type `[4_usize]`
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0308`.

View File

@ -0,0 +1,12 @@
error[E0308]: mismatched types
--> $DIR/different_byref_simple.rs:12:9
|
LL | u = ConstUsize::<4> {};
| ^^^^^^^^^^^^^^^^^^ expected `3_usize`, found `4_usize`
|
= note: expected struct `ConstUsize<3_usize>`
found struct `ConstUsize<4_usize>`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.

View File

@ -0,0 +1,12 @@
error[E0308]: mismatched types
--> $DIR/different_byref_simple.rs:12:9
|
LL | u = ConstUsize::<4> {};
| ^^^^^^^^^^^^^^^^^^ expected `3_usize`, found `4_usize`
|
= note: expected struct `ConstUsize<3_usize>`
found struct `ConstUsize<4_usize>`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.

View File

@ -0,0 +1,14 @@
// Check that different const types are different.
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
struct ConstUsize<const V: usize> {}
fn main() {
let mut u = ConstUsize::<3> {};
u = ConstUsize::<4> {};
//~^ ERROR mismatched types
}

View File

@ -0,0 +1,14 @@
error: using function pointers as const generic parameters is forbidden
--> $DIR/fn-const-param-call.rs:12:25
|
LL | struct Wrapper<const F: fn() -> u32>;
| ^^^^^^^^^^^
error: using function pointers as const generic parameters is forbidden
--> $DIR/fn-const-param-call.rs:14:15
|
LL | impl<const F: fn() -> u32> Wrapper<F> {
| ^^^^^^^^^^^
error: aborting due to 2 previous errors

View File

@ -0,0 +1,20 @@
error: using function pointers as const generic parameters is forbidden
--> $DIR/fn-const-param-call.rs:12:25
|
LL | struct Wrapper<const F: fn() -> u32>;
| ^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error: using function pointers as const generic parameters is forbidden
--> $DIR/fn-const-param-call.rs:14:15
|
LL | impl<const F: fn() -> u32> Wrapper<F> {
| ^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error: aborting due to 2 previous errors

View File

@ -1,5 +1,9 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// Check that functions cannot be used as const parameters.
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
fn function() -> u32 {
17

View File

@ -1,23 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/fn-const-param-call.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error: using function pointers as const generic parameters is forbidden
--> $DIR/fn-const-param-call.rs:8:25
|
LL | struct Wrapper<const F: fn() -> u32>;
| ^^^^^^^^^^^
error: using function pointers as const generic parameters is forbidden
--> $DIR/fn-const-param-call.rs:10:15
|
LL | impl<const F: fn() -> u32> Wrapper<F> {
| ^^^^^^^^^^^
error: aborting due to 2 previous errors; 1 warning emitted

View File

@ -0,0 +1,8 @@
error: using function pointers as const generic parameters is forbidden
--> $DIR/fn-const-param-infer.rs:7:25
|
LL | struct Checked<const F: fn(usize) -> bool>;
| ^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View File

@ -0,0 +1,11 @@
error: using function pointers as const generic parameters is forbidden
--> $DIR/fn-const-param-infer.rs:7:25
|
LL | struct Checked<const F: fn(usize) -> bool>;
| ^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error: aborting due to previous error

View File

@ -1,5 +1,8 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
struct Checked<const F: fn(usize) -> bool>;
//~^ ERROR: using function pointers as const generic parameters

View File

@ -1,17 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/fn-const-param-infer.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error: using function pointers as const generic parameters is forbidden
--> $DIR/fn-const-param-infer.rs:4:25
|
LL | struct Checked<const F: fn(usize) -> bool>;
| ^^^^^^^^^^^^^^^^^
error: aborting due to previous error; 1 warning emitted

View File

@ -1,7 +1,9 @@
// run-pass
// revisions: full min
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
use std::fmt::Display;

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/fn-taking-const-generic-array.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -0,0 +1,9 @@
error[E0741]: `C` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter
--> $DIR/forbid-non-structural_match-types.rs:15:19
|
LL | struct D<const X: C>;
| ^ `C` doesn't derive both `PartialEq` and `Eq`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0741`.

View File

@ -0,0 +1,27 @@
error: using `A` as const generic parameters is forbidden
--> $DIR/forbid-non-structural_match-types.rs:10:19
|
LL | struct B<const X: A>; // ok
| ^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error: using `C` as const generic parameters is forbidden
--> $DIR/forbid-non-structural_match-types.rs:15:19
|
LL | struct D<const X: C>;
| ^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error[E0741]: `C` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter
--> $DIR/forbid-non-structural_match-types.rs:15:19
|
LL | struct D<const X: C>;
| ^ `C` doesn't derive both `PartialEq` and `Eq`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0741`.

View File

@ -1,13 +1,18 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
#[derive(PartialEq, Eq)]
struct A;
struct B<const X: A>; // ok
//[min]~^ ERROR using `A` as const generic parameters is forbidden
struct C;
struct D<const X: C>; //~ ERROR `C` must be annotated with `#[derive(PartialEq, Eq)]`
//[min]~^ ERROR using `C` as const generic parameters is forbidden
fn main() {}

View File

@ -1,18 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/forbid-non-structural_match-types.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error[E0741]: `C` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter
--> $DIR/forbid-non-structural_match-types.rs:11:19
|
LL | struct D<const X: C>;
| ^ `C` doesn't derive both `PartialEq` and `Eq`
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0741`.

View File

@ -1,14 +1,5 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/foreign-item-const-parameter.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error[E0044]: foreign items may not have const parameters
--> $DIR/foreign-item-const-parameter.rs:5:5
--> $DIR/foreign-item-const-parameter.rs:8:5
|
LL | fn foo<const X: usize>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ can't have const parameters
@ -16,13 +7,13 @@ LL | fn foo<const X: usize>();
= help: replace the const parameters with concrete consts
error[E0044]: foreign items may not have type or const parameters
--> $DIR/foreign-item-const-parameter.rs:7:5
--> $DIR/foreign-item-const-parameter.rs:10:5
|
LL | fn bar<T, const X: usize>(_: T);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't have type or const parameters
|
= help: replace the type or const parameters with concrete types or consts
error: aborting due to 2 previous errors; 1 warning emitted
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0044`.

View File

@ -0,0 +1,19 @@
error[E0044]: foreign items may not have const parameters
--> $DIR/foreign-item-const-parameter.rs:8:5
|
LL | fn foo<const X: usize>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ can't have const parameters
|
= help: replace the const parameters with concrete consts
error[E0044]: foreign items may not have type or const parameters
--> $DIR/foreign-item-const-parameter.rs:10:5
|
LL | fn bar<T, const X: usize>(_: T);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't have type or const parameters
|
= help: replace the type or const parameters with concrete types or consts
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0044`.

View File

@ -1,5 +1,8 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
extern "C" {
fn foo<const X: usize>(); //~ ERROR foreign items may not have const parameters

View File

@ -1,7 +1,9 @@
// run-pass
// revisions: full min
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
struct S<const X: u32>;

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/impl-const-generic-struct.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -0,0 +1,15 @@
error[E0107]: wrong number of const arguments: expected 2, found 1
--> $DIR/incorrect-number-of-const-args.rs:12:5
|
LL | foo::<0>();
| ^^^^^^^^ expected 2 const arguments
error[E0107]: wrong number of const arguments: expected 2, found 3
--> $DIR/incorrect-number-of-const-args.rs:13:17
|
LL | foo::<0, 0, 0>();
| ^ unexpected const argument
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0107`.

View File

@ -0,0 +1,15 @@
error[E0107]: wrong number of const arguments: expected 2, found 1
--> $DIR/incorrect-number-of-const-args.rs:12:5
|
LL | foo::<0>();
| ^^^^^^^^ expected 2 const arguments
error[E0107]: wrong number of const arguments: expected 2, found 3
--> $DIR/incorrect-number-of-const-args.rs:13:17
|
LL | foo::<0, 0, 0>();
| ^ unexpected const argument
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0107`.

View File

@ -1,5 +1,8 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
fn foo<const X: usize, const Y: usize>() -> usize {
0

View File

@ -1,24 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/incorrect-number-of-const-args.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error[E0107]: wrong number of const arguments: expected 2, found 1
--> $DIR/incorrect-number-of-const-args.rs:9:5
|
LL | foo::<0>();
| ^^^^^^^^ expected 2 const arguments
error[E0107]: wrong number of const arguments: expected 2, found 3
--> $DIR/incorrect-number-of-const-args.rs:10:17
|
LL | foo::<0, 0, 0>();
| ^ unexpected const argument
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0107`.

View File

@ -1,8 +1,11 @@
// run-pass
//
// see issue #70529
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
struct A<const N: usize> {
arr: [u8; N],

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/infer_arg_from_pat.rs:4:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -1,8 +1,11 @@
// check-pass
//
// see issue #70529
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
fn as_chunks<const N: usize>() -> [u8; N] {
loop {}

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/infer_arr_len_from_pat.rs:4:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -1,7 +1,9 @@
// check-pass
// revisions: full min
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
fn takes_closure_of_array_3<F>(f: F) where F: Fn([i32; 3]) {
f([1, 2, 3]);
@ -15,4 +17,7 @@ fn returns_closure_of_array_3() -> impl Fn([i32; 3]) {
|_| {}
}
fn main() {}
fn main() {
takes_closure_of_array_3(returns_closure_of_array_3());
takes_closure_of_array_3_apit(returns_closure_of_array_3());
}

View File

@ -1,11 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/integer-literal-generic-arg-in-where-clause.rs:3:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
warning: 1 warning emitted

View File

@ -0,0 +1,18 @@
error: constant expression depends on a generic parameter
--> $DIR/issue-61522-array-len-succ.rs:7:40
|
LL | pub struct MyArray<const COUNT: usize>([u8; COUNT + 1]);
| ^^^^^^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: constant expression depends on a generic parameter
--> $DIR/issue-61522-array-len-succ.rs:12:24
|
LL | fn inner(&self) -> &[u8; COUNT + 1] {
| ^^^^^^^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: aborting due to 2 previous errors

View File

@ -0,0 +1,18 @@
error: generic parameters must not be used inside of non trivial constant values
--> $DIR/issue-61522-array-len-succ.rs:7:45
|
LL | pub struct MyArray<const COUNT: usize>([u8; COUNT + 1]);
| ^^^^^ non-trivial anonymous constants must not depend on the parameter `COUNT`
|
= help: it is currently only allowed to use either `COUNT` or `{ COUNT }` as generic constants
error: generic parameters must not be used inside of non trivial constant values
--> $DIR/issue-61522-array-len-succ.rs:12:30
|
LL | fn inner(&self) -> &[u8; COUNT + 1] {
| ^^^^^ non-trivial anonymous constants must not depend on the parameter `COUNT`
|
= help: it is currently only allowed to use either `COUNT` or `{ COUNT }` as generic constants
error: aborting due to 2 previous errors

View File

@ -1,12 +1,17 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
pub struct MyArray<const COUNT: usize>([u8; COUNT + 1]);
//~^ ERROR constant expression depends on a generic parameter
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used
impl<const COUNT: usize> MyArray<COUNT> {
fn inner(&self) -> &[u8; COUNT + 1] {
//~^ ERROR constant expression depends on a generic parameter
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used
&self.0
}
}

View File

@ -1,27 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-61522-array-len-succ.rs:1:12
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
error: constant expression depends on a generic parameter
--> $DIR/issue-61522-array-len-succ.rs:4:40
|
LL | pub struct MyArray<const COUNT: usize>([u8; COUNT + 1]);
| ^^^^^^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: constant expression depends on a generic parameter
--> $DIR/issue-61522-array-len-succ.rs:8:24
|
LL | fn inner(&self) -> &[u8; COUNT + 1] {
| ^^^^^^^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: aborting due to 2 previous errors; 1 warning emitted

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