Added more min_const_generics revisions to tests

This commit is contained in:
Amjad Alsharafi 2020-08-26 18:44:00 +08:00
parent d39cc45cf2
commit d89d2a972d
34 changed files with 224 additions and 157 deletions

View File

@ -0,0 +1,9 @@
error[E0741]: `&'static (dyn A + 'static)` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter
--> $DIR/issue-63322-forbid-dyn.rs:10:18
|
LL | fn test<const T: &'static dyn A>() {
| ^^^^^^^^^^^^^^ `&'static (dyn A + 'static)` 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,18 @@
error: `&'static (dyn A + 'static)` is forbidden as the type of a const generic parameter
--> $DIR/issue-63322-forbid-dyn.rs:10:18
|
LL | fn test<const T: &'static dyn A>() {
| ^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error[E0741]: `&'static (dyn A + 'static)` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter
--> $DIR/issue-63322-forbid-dyn.rs:10:18
|
LL | fn test<const T: &'static dyn A>() {
| ^^^^^^^^^^^^^^ `&'static (dyn A + 'static)` doesn't derive both `PartialEq` and `Eq`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0741`.

View File

@ -1,12 +1,16 @@
#![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))]
trait A {}
struct B;
impl A for B {}
fn test<const T: &'static dyn A>() {
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` to be used
//[full]~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]` to be used
//[min]~^^ ERROR `&'static (dyn A + 'static)` is forbidden as the type of a const generic parameter
//[min]~| ERROR must be annotated with `#[derive(PartialEq, Eq)]` to be used
unimplemented!()
}

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/issue-63322-forbid-dyn.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]: `&'static (dyn A + 'static)` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter
--> $DIR/issue-63322-forbid-dyn.rs:8:18
|
LL | fn test<const T: &'static dyn A>() {
| ^^^^^^^^^^^^^^ `&'static (dyn A + 'static)` 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,5 +1,5 @@
error: constant expression depends on a generic parameter
--> $DIR/issue-64494.rs:14:53
--> $DIR/issue-64494.rs:16:53
|
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
| ^^^^
@ -7,7 +7,7 @@ LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
= note: this may fail depending on what value the parameter takes
error: constant expression depends on a generic parameter
--> $DIR/issue-64494.rs:16:53
--> $DIR/issue-64494.rs:19:53
|
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {}
| ^^^^

View File

@ -0,0 +1,28 @@
error: generic parameters must not be used inside of non trivial constant values
--> $DIR/issue-64494.rs:16:38
|
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
| ^^^^^^ non-trivial anonymous constants must not depend on the parameter `T`
|
= help: it is currently only allowed to use either `T` or `{ T }` as generic constants
error: generic parameters must not be used inside of non trivial constant values
--> $DIR/issue-64494.rs:19:38
|
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {}
| ^^^^^^ non-trivial anonymous constants must not depend on the parameter `T`
|
= help: it is currently only allowed to use either `T` or `{ T }` as generic constants
error[E0119]: conflicting implementations of trait `MyTrait`:
--> $DIR/issue-64494.rs:19:1
|
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
| ------------------------------------ first implementation here
...
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0119`.

View File

@ -1,5 +1,7 @@
#![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))]
trait Foo {
const VAL: usize;
@ -12,8 +14,11 @@ struct Is<const T: bool>;
impl True for Is<{true}> {}
impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
//~^ 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
impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {}
//~^ 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
//[min]~| ERROR conflicting implementations of trait `MyTrait`
fn main() {}

View File

@ -1,7 +1,8 @@
// check-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))]
struct Foo<const D: usize> {
state: Option<[u8; D]>,

View File

@ -0,0 +1,10 @@
error: constant expression depends on a generic parameter
--> $DIR/issue-66205.rs:8:12
|
LL | fact::<{ N - 1 }>();
| ^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: aborting due to previous error

View File

@ -0,0 +1,10 @@
error: generic parameters must not be used inside of non trivial constant values
--> $DIR/issue-66205.rs:8:14
|
LL | fact::<{ N - 1 }>();
| ^ 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: aborting due to previous error

View File

@ -1,10 +1,13 @@
// 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, unconditional_recursion)]
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
fn fact<const N: usize>() {
fact::<{ N - 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 inside of non trivial constant values
}
fn main() {}

View File

@ -1,19 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-66205.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
error: constant expression depends on a generic parameter
--> $DIR/issue-66205.rs:6:12
|
LL | fact::<{ N - 1 }>();
| ^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: aborting due to previous error; 1 warning emitted

View File

@ -1,7 +1,8 @@
// check-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))]
pub struct Tuple;

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/issue-66906.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,8 @@
// check-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))]
trait Baz {
type Quaks;

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/issue-67185-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,6 +1,8 @@
// check-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))]
pub struct S(u8);

View File

@ -0,0 +1,11 @@
error: `[usize; 0]` is forbidden as the type of a const generic parameter
--> $DIR/issue-68615-adt.rs:7:23
|
LL | struct Const<const V: [usize; 0]> {}
| ^^^^^^^^^^
|
= 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,8 +1,11 @@
// check-pass
#![feature(const_generics)]
#![allow(incomplete_features)]
// [full] check-pass
// 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; 0]> {}
//[min]~^ ERROR `[usize; 0]` is forbidden as the type of a const generic parameter
type MyConst = Const<{ [] }>;
fn main() {

View File

@ -0,0 +1,11 @@
error: `[usize; 0]` is forbidden as the type of a const generic parameter
--> $DIR/issue-68615-array.rs:7:21
|
LL | struct Foo<const V: [usize; 0] > {}
| ^^^^^^^^^^
|
= 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,8 +1,11 @@
// check-pass
#![feature(const_generics)]
#![allow(incomplete_features)]
// [full] check-pass
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(min, feature(min_const_generics))]
struct Foo<const V: [usize; 0] > {}
//[min]~^ ERROR `[usize; 0]` is forbidden as the type of a const generic parameter
type MyFoo = Foo<{ [] }>;

View File

@ -0,0 +1,10 @@
error: constant expression depends on a generic parameter
--> $DIR/issue-68977.rs:35:44
|
LL | FxpStorageHelper<INT_BITS, FRAC_BITS>: FxpStorage,
| ^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: aborting due to previous error

View File

@ -0,0 +1,18 @@
error: generic parameters must not be used inside of non trivial constant values
--> $DIR/issue-68977.rs:29:17
|
LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>;
| ^^^^^^^^ non-trivial anonymous constants must not depend on the parameter `INT_BITS`
|
= help: it is currently only allowed to use either `INT_BITS` or `{ INT_BITS }` as generic constants
error: generic parameters must not be used inside of non trivial constant values
--> $DIR/issue-68977.rs:29:28
|
LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>;
| ^^^^^^^^^ non-trivial anonymous constants must not depend on the parameter `FRAC_BITS`
|
= help: it is currently only allowed to use either `FRAC_BITS` or `{ FRAC_BITS }` as generic constants
error: aborting due to 2 previous errors

View File

@ -1,5 +1,7 @@
#![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 PhantomU8<const X: u8>;
@ -25,11 +27,13 @@ fxp_storage_impls! {
type FxpStorageHelper<const INT_BITS: u8, const FRAC_BITS: u8> =
PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>;
//[min]~^ ERROR generic parameters must not be used inside of non trivial constant values
//[min]~| ERROR generic parameters must not be used inside of non trivial constant values
struct Fxp<const INT_BITS: u8, const FRAC_BITS: u8>
where
FxpStorageHelper<INT_BITS, FRAC_BITS>: FxpStorage,
//~^ ERROR constant expression depends on a generic parameter
//[full]~^ ERROR constant expression depends on a generic parameter
{
storage: <FxpStorageHelper<INT_BITS, FRAC_BITS> as FxpStorage>::SInt,
}

View File

@ -1,19 +0,0 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-68977.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-68977.rs:31:44
|
LL | FxpStorageHelper<INT_BITS, FRAC_BITS>: FxpStorage,
| ^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: aborting due to previous error; 1 warning emitted

View File

@ -1,6 +1,8 @@
// 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 L: usize = 4;

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/issue-70125-1.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,8 @@
// 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))]
fn main() {
<()>::foo();

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/issue-70125-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

@ -1,7 +1,8 @@
// check-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))]
pub trait Trait<const N: usize>: From<<Self as Trait<N>>::Item> {
type Item;

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/issue-70167.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,11 +1,11 @@
error[E0770]: the type of const parameters must not depend on other generic parameters
--> $DIR/issue-71169.rs:4:43
--> $DIR/issue-71169.rs:6:43
|
LL | fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}
| ^^^ the type must not depend on the parameter `LEN`
error: constant expression depends on a generic parameter
--> $DIR/issue-71169.rs:8:14
--> $DIR/issue-71169.rs:12:14
|
LL | foo::<4, DATA>();
| ^^^^

View File

@ -0,0 +1,18 @@
error[E0770]: the type of const parameters must not depend on other generic parameters
--> $DIR/issue-71169.rs:6:43
|
LL | fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}
| ^^^ the type must not depend on the parameter `LEN`
error: `[u8; _]` is forbidden as the type of a const generic parameter
--> $DIR/issue-71169.rs:6:38
|
LL | fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}
| ^^^^^^^^^
|
= 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
For more information about this error, try `rustc --explain E0770`.

View File

@ -1,10 +1,14 @@
#![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 LEN: usize, const DATA: [u8; LEN]>() {}
//~^ ERROR the type of const parameters must not
//[full]~^ ERROR the type of const parameters must not
//[min]~^^ ERROR the type of const parameters must not
//[min]~| ERROR `[u8; _]` is forbidden as the type of a const generic parameter
fn main() {
const DATA: [u8; 4] = *b"ABCD";
foo::<4, DATA>();
//~^ ERROR constant expression depends on
//[full]~^ ERROR constant expression depends on
}