-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #75938 - Amjad50:min_const_generics-tests-revisions, …
…r=lcnr Added some `min_const_generics` revisions into `const_generics` tests Help in #75279. still a lot more to cover though r? @lcnr
- Loading branch information
Showing
107 changed files
with
762 additions
and
375 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
...t/ui/const-generics/argument_order.stderr → ...const-generics/argument_order.full.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
error: type parameters must be declared prior to const parameters | ||
--> $DIR/argument_order.rs:6:28 | ||
| | ||
LL | struct Bad<const N: usize, T> { | ||
| -----------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const N: usize>` | ||
|
||
error: lifetime parameters must be declared prior to const parameters | ||
--> $DIR/argument_order.rs:12:32 | ||
| | ||
LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> { | ||
| -----------------^^-----^^-------------------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T, U, const N: usize, const M: usize>` | ||
|
||
error: type parameters must be declared prior to const parameters | ||
--> $DIR/argument_order.rs:12:36 | ||
| | ||
LL | struct AlsoBad<const N: usize, 'a, T, 'b, const M: usize, U> { | ||
| ---------------------^----------------------^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, 'b, T, U, const N: usize, const M: usize>` | ||
|
||
error[E0747]: lifetime provided when a type was expected | ||
--> $DIR/argument_order.rs:20:23 | ||
| | ||
LL | let _: AlsoBad<7, 'static, u32, 'static, 17, u16>; | ||
| ^^^^^^^ | ||
| | ||
= note: lifetime arguments must be provided before type arguments | ||
= help: reorder the arguments: lifetimes, then types, then consts: `<'a, 'b, T, U, N, M>` | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0747`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
src/test/ui/const-generics/array-wrapper-struct-ctor.stderr
This file was deleted.
Oops, something went wrong.
6 changes: 4 additions & 2 deletions
6
src/test/ui/const-generics/cannot-infer-type-for-const-param.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
src/test/ui/const-generics/cannot-infer-type-for-const-param.stderr
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...rics/const-arg-type-arg-misordered.stderr → ...const-arg-type-arg-misordered.full.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/test/ui/const-generics/const-arg-type-arg-misordered.min.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0747]: constant provided when a type was expected | ||
--> $DIR/const-arg-type-arg-misordered.rs:8:35 | ||
| | ||
LL | fn foo<const N: usize>() -> Array<N, ()> { | ||
| ^ | ||
| | ||
= note: type arguments must be provided before constant arguments | ||
= help: reorder the arguments: types, then consts: `<T, N>` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0747`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...cs/const-param-before-other-params.stderr → ...nst-param-before-other-params.full.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/test/ui/const-generics/const-param-before-other-params.min.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
error: lifetime parameters must be declared prior to const parameters | ||
--> $DIR/const-param-before-other-params.rs:6:21 | ||
| | ||
LL | fn bar<const X: (), 'a>(_: &'a ()) { | ||
| --------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, const X: ()>` | ||
|
||
error: type parameters must be declared prior to const parameters | ||
--> $DIR/const-param-before-other-params.rs:11:21 | ||
| | ||
LL | fn foo<const X: (), T>(_: &T) {} | ||
| --------------^- help: reorder the parameters: lifetimes, then types, then consts: `<T, const X: ()>` | ||
|
||
error: `()` is forbidden as the type of a const generic parameter | ||
--> $DIR/const-param-before-other-params.rs:6:17 | ||
| | ||
LL | fn bar<const X: (), 'a>(_: &'a ()) { | ||
| ^^ | ||
| | ||
= note: the only supported types are integers, `bool` and `char` | ||
= note: more complex types are supported with `#[feature(const_generics)]` | ||
|
||
error: `()` is forbidden as the type of a const generic parameter | ||
--> $DIR/const-param-before-other-params.rs:11:17 | ||
| | ||
LL | fn foo<const X: (), T>(_: &T) {} | ||
| ^^ | ||
| | ||
= 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 | ||
|
9 changes: 7 additions & 2 deletions
9
src/test/ui/const-generics/const-param-before-other-params.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
#![allow(incomplete_features)] | ||
#![feature(const_generics)] | ||
// revisions: full min | ||
#![cfg_attr(full, feature(const_generics))] | ||
#![cfg_attr(full, allow(incomplete_features))] | ||
#![cfg_attr(min, feature(min_const_generics))] | ||
|
||
fn bar<const X: (), 'a>(_: &'a ()) { | ||
//~^ ERROR lifetime parameters must be declared prior to const parameters | ||
//[min]~^^ ERROR `()` is forbidden as the type of a const generic parameter | ||
} | ||
|
||
fn foo<const X: (), T>(_: &T) {} | ||
//[min]~^ ERROR type parameters must be declared prior to const parameters | ||
//[min]~^^ ERROR `()` is forbidden as the type of a const generic parameter | ||
|
||
fn main() {} |
9 changes: 9 additions & 0 deletions
9
src/test/ui/const-generics/issues/issue-63322-forbid-dyn.full.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |
18 changes: 18 additions & 0 deletions
18
src/test/ui/const-generics/issues/issue-63322-forbid-dyn.min.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
src/test/ui/const-generics/issues/issue-63322-forbid-dyn.stderr
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
.../const-generics/issues/issue-64494.stderr → ...t-generics/issues/issue-64494.full.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
Oops, something went wrong.