-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 #76514 - hameerabbasi:const-generics-revs, r=lcnr
Add revisions to const generic issue UI tests. Fixes #75279. I have gotten into the flow, so I can do more of these if requested. I'm looking for feedback as to whether my work is on the right track so far.
- Loading branch information
Showing
52 changed files
with
492 additions
and
169 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
4 changes: 2 additions & 2 deletions
4
...onst-argument-cross-crate-mismatch.stderr → ...argument-cross-crate-mismatch.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
15 changes: 15 additions & 0 deletions
15
src/test/ui/const-generics/const-argument-cross-crate-mismatch.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,15 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/const-argument-cross-crate-mismatch.rs:7:67 | ||
| | ||
LL | let _ = const_generic_lib::function(const_generic_lib::Struct([0u8, 1u8])); | ||
| ^^^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/const-argument-cross-crate-mismatch.rs:9:65 | ||
| | ||
LL | let _: const_generic_lib::Alias = const_generic_lib::Struct([0u8, 1u8, 2u8]); | ||
| ^^^^^^^^^^^^^^^ expected an array with a fixed size of 2 elements, found one with 3 elements | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
1 change: 1 addition & 0 deletions
1
src/test/ui/const-generics/const-argument-cross-crate-mismatch.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,4 +1,5 @@ | ||
// aux-build:const_generic_lib.rs | ||
// revisions: full min | ||
|
||
extern crate const_generic_lib; | ||
|
||
|
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,4 +1,5 @@ | ||
// run-pass | ||
// revisions: full min | ||
// aux-build:const_generic_lib.rs | ||
|
||
extern crate const_generic_lib; | ||
|
8 changes: 8 additions & 0 deletions
8
src/test/ui/const-generics/defaults/complex-unord-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: type parameters must be declared prior to const parameters | ||
--> $DIR/complex-unord-param.rs:9:41 | ||
| | ||
LL | struct NestedArrays<'a, const N: usize, A: 'a, const M: usize, T:'a =u32> { | ||
| ---------------------^----------------------^--------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, A: 'a, T: 'a, const N: usize, const M: usize>` | ||
|
||
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
4 changes: 2 additions & 2 deletions
4
...erics/defaults/intermixed-lifetime.stderr → .../defaults/intermixed-lifetime.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
26 changes: 26 additions & 0 deletions
26
src/test/ui/const-generics/defaults/intermixed-lifetime.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,26 @@ | ||
error: lifetime parameters must be declared prior to const parameters | ||
--> $DIR/intermixed-lifetime.rs:7:28 | ||
| | ||
LL | struct Foo<const N: usize, 'a, T = u32>(&'a (), T); | ||
| -----------------^^---------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, const N: usize>` | ||
|
||
error: type parameters must be declared prior to const parameters | ||
--> $DIR/intermixed-lifetime.rs:7:32 | ||
| | ||
LL | struct Foo<const N: usize, 'a, T = u32>(&'a (), T); | ||
| ---------------------^------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, const N: usize>` | ||
|
||
error: lifetime parameters must be declared prior to const parameters | ||
--> $DIR/intermixed-lifetime.rs:11:37 | ||
| | ||
LL | struct Bar<const N: usize, T = u32, 'a>(&'a (), T); | ||
| --------------------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, const N: usize>` | ||
|
||
error: type parameters must be declared prior to const parameters | ||
--> $DIR/intermixed-lifetime.rs:11:28 | ||
| | ||
LL | struct Bar<const N: usize, T = u32, 'a>(&'a (), T); | ||
| -----------------^----------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, const N: usize>` | ||
|
||
error: aborting due to 4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
// revisions: full min | ||
// Checks that lifetimes cannot be interspersed between consts and types. | ||
|
||
#![feature(const_generics)] | ||
#![allow(incomplete_features)] | ||
#![cfg_attr(full, feature(const_generics))] | ||
#![cfg_attr(full, allow(incomplete_features))] | ||
#![cfg_attr(min, feature(min_const_generics))] | ||
|
||
struct Foo<const N: usize, 'a, T = u32>(&'a (), T); | ||
//~^ Error lifetime parameters must be declared prior to const parameters | ||
//[min]~^^ Error type parameters must be declared prior to const parameters | ||
|
||
struct Bar<const N: usize, T = u32, 'a>(&'a (), T); | ||
//~^ Error lifetime parameters must be declared prior to type parameters | ||
//[full]~^ Error lifetime parameters must be declared prior to type parameters | ||
//[min]~^^ Error type parameters must be declared prior to const parameters | ||
//[min]~| Error lifetime parameters must be declared prior to const parameters | ||
|
||
fn main() {} |
8 changes: 8 additions & 0 deletions
8
src/test/ui/const-generics/defaults/simple-defaults.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,8 @@ | ||
error: type parameters must be declared prior to const parameters | ||
--> $DIR/simple-defaults.rs:9:40 | ||
| | ||
LL | struct FixedOutput<'a, const N: usize, T=u32> { | ||
| ---------------------^----- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, const N: usize>` | ||
|
||
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
4 changes: 3 additions & 1 deletion
4
src/test/ui/const-generics/issues/auxiliary/const_generic_issues_lib.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
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-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 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 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.
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
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 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: 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 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-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 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 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 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: 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 | ||
|
Oops, something went wrong.