test min_const_generics using revisions

This commit is contained in:
Bastian Kauschke 2020-08-06 22:57:09 +02:00
parent 37c29adabc
commit 644c894912
24 changed files with 154 additions and 52 deletions

View File

@ -1,5 +1,5 @@
error: type parameters with a default must be trailing
--> $DIR/wrong-order.rs:3:10
--> $DIR/wrong-order.rs:5:10
|
LL | struct A<T = u32, const N: usize> {
| ^
@ -7,10 +7,10 @@ LL | struct A<T = u32, const N: usize> {
= note: using type defaults and const parameters in the same parameter list is currently not permitted
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/wrong-order.rs:1:12
--> $DIR/wrong-order.rs:2:27
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
LL | #![cfg_attr(full, 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

View File

@ -0,0 +1,10 @@
error: type parameters with a default must be trailing
--> $DIR/wrong-order.rs:5:10
|
LL | struct A<T = u32, const N: usize> {
| ^
|
= note: using type defaults and const parameters in the same parameter list is currently not permitted
error: aborting due to previous error

View File

@ -1,4 +1,6 @@
#![feature(const_generics)] //~ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete
#![cfg_attr(min, feature(min_const_generics))]
struct A<T = u32, const N: usize> {
//~^ ERROR type parameters with a default must be trailing

View File

@ -1,8 +1,8 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-56445.rs:3:12
--> $DIR/issue-56445.rs:3:27
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
LL | #![cfg_attr(full, 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

View File

@ -0,0 +1,20 @@
error[E0771]: use of non-static lifetime `'a` in const generic
--> $DIR/issue-56445.rs:9:26
|
LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
| ^^
|
= note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052>
error: using `&'static str` as const generic parameters is forbidden
--> $DIR/issue-56445.rs:9:25
|
LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
| ^^^^^^^
|
= 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 E0771`.

View File

@ -1,12 +1,13 @@
// Regression test for https://github.com/rust-lang/rust/issues/56445#issuecomment-518402995.
#![feature(const_generics)]
//~^ WARN: the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete
#![cfg_attr(min, feature(min_const_generics))]
#![crate_type = "lib"]
use std::marker::PhantomData;
struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
//~^ ERROR: use of non-static lifetime `'a` in const generic
//[min]~| ERROR: using `&'static str` as const
impl Bug<'_, ""> {}

View File

@ -1,8 +1,8 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-61336-1.rs:1:12
--> $DIR/issue-60818-struct-constructors.rs:3:27
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
LL | #![cfg_attr(full, 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

View File

@ -1,7 +1,7 @@
// check-pass
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete
#![cfg_attr(min, feature(min_const_generics))]
struct Generic<const V: usize>;

View File

@ -1,8 +1,8 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-60818-struct-constructors.rs:3:12
--> $DIR/issue-61336-1.rs:3:27
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
LL | #![cfg_attr(full, 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

View File

@ -1,7 +1,7 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// build-pass
// revisions: full min
#![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete
#![cfg_attr(min, feature(min_const_generics))]
fn f<T: Copy, const N: usize>(x: T) -> [T; N] {
[x; N]

View File

@ -1,14 +1,14 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-61336-2.rs:1:12
--> $DIR/issue-61336-2.rs:2:27
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
LL | #![cfg_attr(full, 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[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/issue-61336-2.rs:9:5
--> $DIR/issue-61336-2.rs:10:5
|
LL | [x; { N }]
| ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`

View File

@ -0,0 +1,15 @@
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/issue-61336-2.rs:10:5
|
LL | [x; { N }]
| ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
|
= note: the `Copy` trait is required because the repeated element will be copied
help: consider restricting type parameter `T`
|
LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,5 +1,6 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete
#![cfg_attr(min, feature(min_const_generics))]
fn f<T: Copy, const N: usize>(x: T) -> [T; N] {
[x; { N }]

View File

@ -0,0 +1,24 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-61336.rs:2:27
|
LL | #![cfg_attr(full, 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[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/issue-61336.rs:10:5
|
LL | [x; N]
| ^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
|
= note: the `Copy` trait is required because the repeated element will be copied
help: consider restricting type parameter `T`
|
LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0277`.

View File

@ -0,0 +1,15 @@
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
--> $DIR/issue-61336.rs:10:5
|
LL | [x; N]
| ^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
|
= note: the `Copy` trait is required because the repeated element will be copied
help: consider restricting type parameter `T`
|
LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {
| ^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.

View File

@ -1,5 +1,6 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete
#![cfg_attr(min, feature(min_const_generics))]
fn f<T: Copy, const N: usize>(x: T) -> [T; N] {
[x; N]

View File

@ -1,8 +1,8 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-61432.rs:3:12
--> $DIR/issue-61422.rs:3:27
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
LL | #![cfg_attr(full, 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

View File

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

View File

@ -1,8 +1,8 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-61422.rs:3:12
--> $DIR/issue-61432.rs:3:27
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
LL | #![cfg_attr(full, 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

View File

@ -1,7 +1,7 @@
// run-pass
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete
#![cfg_attr(min, feature(min_const_generics))]
fn promote<const N: i32>() {
// works:

View File

@ -1,14 +1,14 @@
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-61747.rs:1:12
--> $DIR/issue-61747.rs:2:27
|
LL | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
LL | #![cfg_attr(full, 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-61747.rs:7:23
--> $DIR/issue-61747.rs:8:23
|
LL | fn successor() -> Const<{C + 1}> {
| ^^^^^^^^^^^^^^

View File

@ -0,0 +1,10 @@
error: generic parameters must not be used inside of non trivial constant values
--> $DIR/issue-61747.rs:8:30
|
LL | fn successor() -> Const<{C + 1}> {
| ^ non-trivial anonymous constants must not depend on the parameter `C`
|
= help: it is currently only allowed to use either `C` or `{ C }` as generic constants
error: aborting due to previous error

View File

@ -1,11 +1,13 @@
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete
// revisions: full min
#![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete
#![cfg_attr(min, feature(min_const_generics))]
struct Const<const N: usize>;
impl<const C: usize> Const<{C}> {
fn successor() -> Const<{C + 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
Const
}
}

View File

@ -1,7 +1,8 @@
// run-pass
#![feature(const_generics)]
// revisions: full min
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(min, feature(min_const_generics))]
#![allow(incomplete_features)]
#![feature(const_fn)]
struct Foo;