forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
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 rust-lang#77825 - ethanboxx:min_const_generics_diagno…
…stic, r=lcnr `min_const_generics` diagnostics improvements As disscussed in [zulip/project-const-generics/non-trivial anonymous constant](https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/non-trivial.20anonymous.20constants). This is my first PR on the compiler. @lcnr is mentoring me on this PR. Related to rust-lang#60551.
- Loading branch information
Showing
56 changed files
with
185 additions
and
192 deletions.
There are no files selected for viewing
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
12 changes: 6 additions & 6 deletions
12
src/test/ui/const-generics/array-size-in-generic-struct-param.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
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
6 changes: 3 additions & 3 deletions
6
src/test/ui/const-generics/const-argument-if-length.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
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
6 changes: 3 additions & 3 deletions
6
...onst-generics/const_evaluatable_checked/feature-gate-const_evaluatable_checked.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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
error: generic parameters must not be used inside of non-trivial constant values | ||
error: generic parameters may not be used in const operations | ||
--> $DIR/feature-gate-const_evaluatable_checked.rs:6:33 | ||
| | ||
LL | type Arr<const N: usize> = [u8; N - 1]; | ||
| ^ non-trivial anonymous constants must not depend on the parameter `N` | ||
| ^ cannot perform const operation using `N` | ||
| | ||
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants | ||
= help: const parameters may only be used as standalone arguments, i.e. `N` | ||
|
||
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
12 changes: 6 additions & 6 deletions
12
src/test/ui/const-generics/const_evaluatable_checked/simple.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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
error: generic parameters must not be used inside of non-trivial constant values | ||
error: generic parameters may not be used in const operations | ||
--> $DIR/simple.rs:8:53 | ||
| | ||
LL | fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default { | ||
| ^ non-trivial anonymous constants must not depend on the parameter `N` | ||
| ^ cannot perform const operation using `N` | ||
| | ||
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants | ||
= help: const parameters may only be used as standalone arguments, i.e. `N` | ||
|
||
error: generic parameters must not be used inside of non-trivial constant values | ||
error: generic parameters may not be used in const operations | ||
--> $DIR/simple.rs:8:35 | ||
| | ||
LL | fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default { | ||
| ^ non-trivial anonymous constants must not depend on the parameter `N` | ||
| ^ cannot perform const operation using `N` | ||
| | ||
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants | ||
= help: const parameters may only be used as standalone arguments, i.e. `N` | ||
|
||
error: aborting due to 2 previous errors | ||
|
6 changes: 3 additions & 3 deletions
6
src/test/ui/const-generics/const_evaluatable_checked/simple_fail.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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
error: generic parameters must not be used inside of non-trivial constant values | ||
error: generic parameters may not be used in const operations | ||
--> $DIR/simple_fail.rs:7:33 | ||
| | ||
LL | type Arr<const N: usize> = [u8; N - 1]; | ||
| ^ non-trivial anonymous constants must not depend on the parameter `N` | ||
| ^ cannot perform const operation using `N` | ||
| | ||
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants | ||
= help: const parameters may only be used as standalone arguments, i.e. `N` | ||
|
||
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
12 changes: 6 additions & 6 deletions
12
src/test/ui/const-generics/generic-function-call-in-array-length.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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
error: generic parameters must not be used inside of non-trivial constant values | ||
error: generic parameters may not be used in const operations | ||
--> $DIR/generic-function-call-in-array-length.rs:9:39 | ||
| | ||
LL | fn bar<const N: usize>() -> [u32; foo(N)] { | ||
| ^ non-trivial anonymous constants must not depend on the parameter `N` | ||
| ^ cannot perform const operation using `N` | ||
| | ||
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants | ||
= help: const parameters may only be used as standalone arguments, i.e. `N` | ||
|
||
error: generic parameters must not be used inside of non-trivial constant values | ||
error: generic parameters may not be used in const operations | ||
--> $DIR/generic-function-call-in-array-length.rs:12:13 | ||
| | ||
LL | [0; foo(N)] | ||
| ^ non-trivial anonymous constants must not depend on the parameter `N` | ||
| ^ cannot perform const operation using `N` | ||
| | ||
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants | ||
= help: const parameters may only be used as standalone arguments, i.e. `N` | ||
|
||
error: aborting due to 2 previous errors | ||
|
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: 6 additions & 6 deletions
12
src/test/ui/const-generics/generic-sum-in-array-length.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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
error: generic parameters must not be used inside of non-trivial constant values | ||
error: generic parameters may not be used in const operations | ||
--> $DIR/generic-sum-in-array-length.rs:7:53 | ||
| | ||
LL | fn foo<const A: usize, const B: usize>(bar: [usize; A + B]) {} | ||
| ^ non-trivial anonymous constants must not depend on the parameter `A` | ||
| ^ cannot perform const operation using `A` | ||
| | ||
= help: it is currently only allowed to use either `A` or `{ A }` as generic constants | ||
= help: const parameters may only be used as standalone arguments, i.e. `A` | ||
|
||
error: generic parameters must not be used inside of non-trivial constant values | ||
error: generic parameters may not be used in const operations | ||
--> $DIR/generic-sum-in-array-length.rs:7:57 | ||
| | ||
LL | fn foo<const A: usize, const B: usize>(bar: [usize; A + B]) {} | ||
| ^ non-trivial anonymous constants must not depend on the parameter `B` | ||
| ^ cannot perform const operation using `B` | ||
| | ||
= help: it is currently only allowed to use either `B` or `{ B }` as generic constants | ||
= help: const parameters may only be used as standalone arguments, i.e. `B` | ||
|
||
error: aborting due to 2 previous errors | ||
|
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
6 changes: 3 additions & 3 deletions
6
src/test/ui/const-generics/intrinsics-type_name-as-const-argument.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
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: 6 additions & 6 deletions
12
src/test/ui/const-generics/issue-61522-array-len-succ.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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
error: generic parameters must not be used inside of non-trivial constant values | ||
error: generic parameters may not be used in const operations | ||
--> $DIR/issue-61522-array-len-succ.rs:7:45 | ||
| | ||
LL | pub struct MyArray<const COUNT: usize>([u8; COUNT + 1]); | ||
| ^^^^^ non-trivial anonymous constants must not depend on the parameter `COUNT` | ||
| ^^^^^ cannot perform const operation using `COUNT` | ||
| | ||
= help: it is currently only allowed to use either `COUNT` or `{ COUNT }` as generic constants | ||
= help: const parameters may only be used as standalone arguments, i.e. `COUNT` | ||
|
||
error: generic parameters must not be used inside of non-trivial constant values | ||
error: generic parameters may not be used in const operations | ||
--> $DIR/issue-61522-array-len-succ.rs:12:30 | ||
| | ||
LL | fn inner(&self) -> &[u8; COUNT + 1] { | ||
| ^^^^^ non-trivial anonymous constants must not depend on the parameter `COUNT` | ||
| ^^^^^ cannot perform const operation using `COUNT` | ||
| | ||
= help: it is currently only allowed to use either `COUNT` or `{ COUNT }` as generic constants | ||
= help: const parameters may only be used as standalone arguments, i.e. `COUNT` | ||
|
||
error: aborting due to 2 previous errors | ||
|
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
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
Oops, something went wrong.