Skip to content

Commit 644c894

Browse files
committed
test min_const_generics using revisions
1 parent 37c29ad commit 644c894

24 files changed

+154
-52
lines changed

src/test/ui/const-generics/defaults/wrong-order.stderr renamed to src/test/ui/const-generics/defaults/wrong-order.full.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
error: type parameters with a default must be trailing
2-
--> $DIR/wrong-order.rs:3:10
2+
--> $DIR/wrong-order.rs:5:10
33
|
44
LL | struct A<T = u32, const N: usize> {
55
| ^
66
|
77
= note: using type defaults and const parameters in the same parameter list is currently not permitted
88

99
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
10-
--> $DIR/wrong-order.rs:1:12
10+
--> $DIR/wrong-order.rs:2:27
1111
|
12-
LL | #![feature(const_generics)]
13-
| ^^^^^^^^^^^^^^
12+
LL | #![cfg_attr(full, feature(const_generics))]
13+
| ^^^^^^^^^^^^^^
1414
|
1515
= note: `#[warn(incomplete_features)]` on by default
1616
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: type parameters with a default must be trailing
2+
--> $DIR/wrong-order.rs:5:10
3+
|
4+
LL | struct A<T = u32, const N: usize> {
5+
| ^
6+
|
7+
= note: using type defaults and const parameters in the same parameter list is currently not permitted
8+
9+
error: aborting due to previous error
10+

src/test/ui/const-generics/defaults/wrong-order.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#![feature(const_generics)] //~ WARN the feature `const_generics` is incomplete
1+
// revisions: full min
2+
#![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete
3+
#![cfg_attr(min, feature(min_const_generics))]
24

35
struct A<T = u32, const N: usize> {
46
//~^ ERROR type parameters with a default must be trailing

src/test/ui/const-generics/issues/issue-56445.stderr renamed to src/test/ui/const-generics/issues/issue-56445.full.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/issue-56445.rs:3:12
2+
--> $DIR/issue-56445.rs:3:27
33
|
4-
LL | #![feature(const_generics)]
5-
| ^^^^^^^^^^^^^^
4+
LL | #![cfg_attr(full, feature(const_generics))]
5+
| ^^^^^^^^^^^^^^
66
|
77
= note: `#[warn(incomplete_features)]` on by default
88
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error[E0771]: use of non-static lifetime `'a` in const generic
2+
--> $DIR/issue-56445.rs:9:26
3+
|
4+
LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
5+
| ^^
6+
|
7+
= note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052>
8+
9+
error: using `&'static str` as const generic parameters is forbidden
10+
--> $DIR/issue-56445.rs:9:25
11+
|
12+
LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
13+
| ^^^^^^^
14+
|
15+
= note: the only supported types are integers, `bool` and `char`
16+
= note: more complex types are supported with `#[feature(const_generics)]`
17+
18+
error: aborting due to 2 previous errors
19+
20+
For more information about this error, try `rustc --explain E0771`.
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
// Regression test for https://github.com/rust-lang/rust/issues/56445#issuecomment-518402995.
2-
3-
#![feature(const_generics)]
4-
//~^ WARN: the feature `const_generics` is incomplete
2+
// revisions: full min
3+
#![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete
4+
#![cfg_attr(min, feature(min_const_generics))]
55
#![crate_type = "lib"]
66

77
use std::marker::PhantomData;
88

99
struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
1010
//~^ ERROR: use of non-static lifetime `'a` in const generic
11+
//[min]~| ERROR: using `&'static str` as const
1112

1213
impl Bug<'_, ""> {}

src/test/ui/const-generics/issues/issue-61336-1.stderr renamed to src/test/ui/const-generics/issues/issue-60818-struct-constructors.full.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/issue-61336-1.rs:1:12
2+
--> $DIR/issue-60818-struct-constructors.rs:3:27
33
|
4-
LL | #![feature(const_generics)]
5-
| ^^^^^^^^^^^^^^
4+
LL | #![cfg_attr(full, feature(const_generics))]
5+
| ^^^^^^^^^^^^^^
66
|
77
= note: `#[warn(incomplete_features)]` on by default
88
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information

src/test/ui/const-generics/issues/issue-60818-struct-constructors.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// check-pass
2-
3-
#![feature(const_generics)]
4-
//~^ WARN the feature `const_generics` is incomplete
2+
// revisions: full min
3+
#![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete
4+
#![cfg_attr(min, feature(min_const_generics))]
55

66
struct Generic<const V: usize>;
77

src/test/ui/const-generics/issues/issue-60818-struct-constructors.stderr renamed to src/test/ui/const-generics/issues/issue-61336-1.full.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/issue-60818-struct-constructors.rs:3:12
2+
--> $DIR/issue-61336-1.rs:3:27
33
|
4-
LL | #![feature(const_generics)]
5-
| ^^^^^^^^^^^^^^
4+
LL | #![cfg_attr(full, feature(const_generics))]
5+
| ^^^^^^^^^^^^^^
66
|
77
= note: `#[warn(incomplete_features)]` on by default
88
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information

src/test/ui/const-generics/issues/issue-61336-1.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#![feature(const_generics)]
2-
//~^ WARN the feature `const_generics` is incomplete
3-
41
// build-pass
2+
// revisions: full min
3+
#![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete
4+
#![cfg_attr(min, feature(min_const_generics))]
55

66
fn f<T: Copy, const N: usize>(x: T) -> [T; N] {
77
[x; N]

src/test/ui/const-generics/issues/issue-61336-2.stderr renamed to src/test/ui/const-generics/issues/issue-61336-2.full.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/issue-61336-2.rs:1:12
2+
--> $DIR/issue-61336-2.rs:2:27
33
|
4-
LL | #![feature(const_generics)]
5-
| ^^^^^^^^^^^^^^
4+
LL | #![cfg_attr(full, feature(const_generics))]
5+
| ^^^^^^^^^^^^^^
66
|
77
= note: `#[warn(incomplete_features)]` on by default
88
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
99

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

src/test/ui/const-generics/issues/issue-61336-2.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#![feature(const_generics)]
2-
//~^ WARN the feature `const_generics` is incomplete
1+
// revisions: full min
2+
#![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete
3+
#![cfg_attr(min, feature(min_const_generics))]
34

45
fn f<T: Copy, const N: usize>(x: T) -> [T; N] {
56
[x; { N }]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
2+
--> $DIR/issue-61336.rs:2:27
3+
|
4+
LL | #![cfg_attr(full, feature(const_generics))]
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(incomplete_features)]` on by default
8+
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
9+
10+
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
11+
--> $DIR/issue-61336.rs:10:5
12+
|
13+
LL | [x; N]
14+
| ^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
15+
|
16+
= note: the `Copy` trait is required because the repeated element will be copied
17+
help: consider restricting type parameter `T`
18+
|
19+
LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {
20+
| ^^^^^^^^^^^^^^^^^^^
21+
22+
error: aborting due to previous error; 1 warning emitted
23+
24+
For more information about this error, try `rustc --explain E0277`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
2+
--> $DIR/issue-61336.rs:10:5
3+
|
4+
LL | [x; N]
5+
| ^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
6+
|
7+
= note: the `Copy` trait is required because the repeated element will be copied
8+
help: consider restricting type parameter `T`
9+
|
10+
LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] {
11+
| ^^^^^^^^^^^^^^^^^^^
12+
13+
error: aborting due to previous error
14+
15+
For more information about this error, try `rustc --explain E0277`.

src/test/ui/const-generics/issues/issue-61336.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#![feature(const_generics)]
2-
//~^ WARN the feature `const_generics` is incomplete
1+
// revisions: full min
2+
#![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete
3+
#![cfg_attr(min, feature(min_const_generics))]
34

45
fn f<T: Copy, const N: usize>(x: T) -> [T; N] {
56
[x; N]

src/test/ui/const-generics/issues/issue-61432.stderr renamed to src/test/ui/const-generics/issues/issue-61422.full.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/issue-61432.rs:3:12
2+
--> $DIR/issue-61422.rs:3:27
33
|
4-
LL | #![feature(const_generics)]
5-
| ^^^^^^^^^^^^^^
4+
LL | #![cfg_attr(full, feature(const_generics))]
5+
| ^^^^^^^^^^^^^^
66
|
77
= note: `#[warn(incomplete_features)]` on by default
88
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information

src/test/ui/const-generics/issues/issue-61422.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// check-pass
2-
3-
#![feature(const_generics)]
4-
//~^ WARN the feature `const_generics` is incomplete
2+
// revisions: full min
3+
#![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete
4+
#![cfg_attr(min, feature(min_const_generics))]
55

66
use std::mem;
77

src/test/ui/const-generics/issues/issue-61422.stderr renamed to src/test/ui/const-generics/issues/issue-61432.full.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/issue-61422.rs:3:12
2+
--> $DIR/issue-61432.rs:3:27
33
|
4-
LL | #![feature(const_generics)]
5-
| ^^^^^^^^^^^^^^
4+
LL | #![cfg_attr(full, feature(const_generics))]
5+
| ^^^^^^^^^^^^^^
66
|
77
= note: `#[warn(incomplete_features)]` on by default
88
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information

src/test/ui/const-generics/issues/issue-61432.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// run-pass
2-
3-
#![feature(const_generics)]
4-
//~^ WARN the feature `const_generics` is incomplete
2+
// revisions: full min
3+
#![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete
4+
#![cfg_attr(min, feature(min_const_generics))]
55

66
fn promote<const N: i32>() {
77
// works:

src/test/ui/const-generics/issues/issue-61747.stderr renamed to src/test/ui/const-generics/issues/issue-61747.full.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/issue-61747.rs:1:12
2+
--> $DIR/issue-61747.rs:2:27
33
|
4-
LL | #![feature(const_generics)]
5-
| ^^^^^^^^^^^^^^
4+
LL | #![cfg_attr(full, feature(const_generics))]
5+
| ^^^^^^^^^^^^^^
66
|
77
= note: `#[warn(incomplete_features)]` on by default
88
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
99

1010
error: constant expression depends on a generic parameter
11-
--> $DIR/issue-61747.rs:7:23
11+
--> $DIR/issue-61747.rs:8:23
1212
|
1313
LL | fn successor() -> Const<{C + 1}> {
1414
| ^^^^^^^^^^^^^^
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: generic parameters must not be used inside of non trivial constant values
2+
--> $DIR/issue-61747.rs:8:30
3+
|
4+
LL | fn successor() -> Const<{C + 1}> {
5+
| ^ non-trivial anonymous constants must not depend on the parameter `C`
6+
|
7+
= help: it is currently only allowed to use either `C` or `{ C }` as generic constants
8+
9+
error: aborting due to previous error
10+

src/test/ui/const-generics/issues/issue-61747.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
#![feature(const_generics)]
2-
//~^ WARN the feature `const_generics` is incomplete
1+
// revisions: full min
2+
#![cfg_attr(full, feature(const_generics))] //[full]~WARN the feature `const_generics` is incomplete
3+
#![cfg_attr(min, feature(min_const_generics))]
34

45
struct Const<const N: usize>;
56

67
impl<const C: usize> Const<{C}> {
78
fn successor() -> Const<{C + 1}> {
8-
//~^ ERROR constant expression depends on a generic parameter
9+
//[full]~^ ERROR constant expression depends on a generic parameter
10+
//[min]~^^ ERROR generic parameters must not be used
911
Const
1012
}
1113
}

src/test/ui/const-generics/type-dependent/const-arg-in-const-arg.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// run-pass
2-
#![feature(const_generics)]
2+
// revisions: full min
3+
#![cfg_attr(full, feature(const_generics))]
4+
#![cfg_attr(min, feature(min_const_generics))]
35
#![allow(incomplete_features)]
4-
#![feature(const_fn)]
56

67
struct Foo;
78

0 commit comments

Comments
 (0)