-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Added some min_const_generics
revisions into const_generics
tests
#75938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bors
merged 4 commits into
rust-lang:master
from
Amjad50:min_const_generics-tests-revisions
Aug 31, 2020
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d39cc45
Added a lot of min_const_generics revisions
Amjad50 d89d2a9
Added more min_const_generics revisions to tests
Amjad50 7a7a28d
Fixed file formatting and made `tidy` happy
Amjad50 668f63d
Fix duplicate error messages in const_generics tests
Amjad50 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.