-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add revisions to const generic issue UI tests. #76514
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
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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: 3 additions & 1 deletion
4
src/test/ui/const-generics/issues/auxiliary/const_generic_issues_lib.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
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-61935.rs:10:14 | ||
| | ||
LL | Self:FooImpl<{N==0}> | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= 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-61935.rs:10:23 | ||
| | ||
LL | Self:FooImpl<{N==0}> | ||
| ^ 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
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
src/test/ui/const-generics/issues/issue-62187-encountered-polymorphic-const.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,10 @@ | ||
warning: unused variable: `foo` | ||
--> $DIR/issue-62187-encountered-polymorphic-const.rs:17:9 | ||
| | ||
LL | let foo = <[u8; 2]>::BIT_LEN; | ||
| ^^^ help: if this is intentional, prefix it with an underscore: `_foo` | ||
| | ||
= note: `#[warn(unused_variables)]` on by default | ||
|
||
warning: 1 warning emitted | ||
|
10 changes: 10 additions & 0 deletions
10
src/test/ui/const-generics/issues/issue-62187-encountered-polymorphic-const.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,10 @@ | ||
warning: unused variable: `foo` | ||
--> $DIR/issue-62187-encountered-polymorphic-const.rs:17:9 | ||
| | ||
LL | let foo = <[u8; 2]>::BIT_LEN; | ||
hameerabbasi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ^^^ help: if this is intentional, prefix it with an underscore: `_foo` | ||
| | ||
= note: `#[warn(unused_variables)]` on by default | ||
|
||
warning: 1 warning emitted | ||
|
6 changes: 4 additions & 2 deletions
6
src/test/ui/const-generics/issues/issue-62187-encountered-polymorphic-const.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
19 changes: 0 additions & 19 deletions
19
src/test/ui/const-generics/issues/issue-62187-encountered-polymorphic-const.stderr
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
.../const-generics/issues/issue-62220.stderr → ...t-generics/issues/issue-62220.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,10 @@ | ||
error: generic parameters must not be used inside of non trivial constant values | ||
--> $DIR/issue-62220.rs:8:59 | ||
| | ||
LL | pub type TruncatedVector<T, const N: usize> = Vector<T, { 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
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-62456.rs:7:20 | ||
| | ||
LL | let _ = [0u64; 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-62456.rs:7:20 | ||
| | ||
LL | let _ = [0u64; 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,9 +1,12 @@ | ||
#![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 foo<const N: usize>() { | ||
let _ = [0u64; 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() {} |
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
.../const-generics/issues/issue-62504.stderr → ...t-generics/issues/issue-62504.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,10 @@ | ||
error: generic parameters must not be used inside of non trivial constant values | ||
--> $DIR/issue-62504.rs:19:25 | ||
| | ||
LL | ArrayHolder([0; Self::SIZE]) | ||
| ^^^^^^^^^^ non-trivial anonymous constants must not depend on the parameter `Self` | ||
| | ||
= help: it is currently only allowed to use either `Self` or `{ Self }` 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
11 changes: 11 additions & 0 deletions
11
src/test/ui/const-generics/issues/issue-62579-no-match.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,11 @@ | ||
error: `NoMatch` is forbidden as the type of a const generic parameter | ||
--> $DIR/issue-62579-no-match.rs:10:17 | ||
| | ||
LL | fn foo<const T: NoMatch>() -> bool { | ||
| ^^^^^^^ | ||
| | ||
= 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 | ||
|
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/issues/issue-62579-no-match.stderr
This file was deleted.
Oops, something went wrong.
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[E0770]: the type of const parameters must not depend on other generic parameters | ||
--> $DIR/issue-62878.rs:6:38 | ||
| | ||
LL | fn foo<const N: usize, const A: [u8; N]>() {} | ||
| ^ the type must not depend on the parameter `N` | ||
|
||
error[E0107]: wrong number of const arguments: expected 2, found 1 | ||
--> $DIR/issue-62878.rs:11:5 | ||
| | ||
LL | foo::<_, {[1]}>(); | ||
| ^^^^^^^^^^^^^^^ expected 2 const arguments | ||
|
||
error[E0107]: wrong number of type arguments: expected 0, found 1 | ||
--> $DIR/issue-62878.rs:11:11 | ||
| | ||
LL | foo::<_, {[1]}>(); | ||
| ^ unexpected type argument | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-62878.rs:11:15 | ||
| | ||
LL | foo::<_, {[1]}>(); | ||
| ^^^ expected `usize`, found array `[{integer}; 1]` | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
Some errors have detailed explanations: E0107, E0308, E0770. | ||
For more information about an error, try `rustc --explain E0107`. |
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[E0770]: the type of const parameters must not depend on other generic parameters | ||
--> $DIR/issue-62878.rs:6:38 | ||
| | ||
LL | fn foo<const N: usize, const A: [u8; N]>() {} | ||
| ^ the type must not depend on the parameter `N` | ||
|
||
error: `[u8; _]` is forbidden as the type of a const generic parameter | ||
--> $DIR/issue-62878.rs:6:33 | ||
| | ||
LL | fn foo<const N: usize, const A: [u8; N]>() {} | ||
| ^^^^^^^ | ||
| | ||
= 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`. |
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,11 +1,15 @@ | ||
#![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 foo<const N: usize, const A: [u8; N]>() {} | ||
//~^ ERROR the type of const parameters must not | ||
//[min]~| ERROR `[u8; _]` is forbidden as the type of a const generic parameter | ||
|
||
fn main() { | ||
foo::<_, {[1]}>(); | ||
//~^ ERROR wrong number of const arguments | ||
//~| ERROR wrong number of type arguments | ||
//~| ERROR mismatched types | ||
//[full]~^ ERROR wrong number of const arguments | ||
//[full]~| ERROR wrong number of type arguments | ||
//[full]~| ERROR mismatched types | ||
} |
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.