Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 7565ccc

Browse files
authored
Rollup merge of rust-lang#76514 - hameerabbasi:const-generics-revs, r=lcnr
Add revisions to const generic issue UI tests. Fixes rust-lang#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.
2 parents 91c3ef8 + bec8e5f commit 7565ccc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+492
-169
lines changed

src/test/ui/const-generics/auxiliary/const_generic_lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#![feature(const_generics)]
1+
#![cfg_attr(full, feature(const_generics))]
2+
#![cfg_attr(full, allow(incomplete_features))]
3+
#![cfg_attr(min, feature(min_const_generics))]
24

35
pub struct Struct<const N: usize>(pub [u8; N]);
46

src/test/ui/const-generics/auxiliary/impl-const.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#![feature(const_generics)]
1+
#![cfg_attr(full, feature(const_generics))]
2+
#![cfg_attr(full, allow(incomplete_features))]
3+
#![cfg_attr(min, feature(min_const_generics))]
24

35
pub struct Num<const N: usize>;
46

src/test/ui/const-generics/const-argument-cross-crate-mismatch.stderr renamed to src/test/ui/const-generics/const-argument-cross-crate-mismatch.full.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0308]: mismatched types
2-
--> $DIR/const-argument-cross-crate-mismatch.rs:6:67
2+
--> $DIR/const-argument-cross-crate-mismatch.rs:7:67
33
|
44
LL | let _ = const_generic_lib::function(const_generic_lib::Struct([0u8, 1u8]));
55
| ^^^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements
66

77
error[E0308]: mismatched types
8-
--> $DIR/const-argument-cross-crate-mismatch.rs:8:65
8+
--> $DIR/const-argument-cross-crate-mismatch.rs:9:65
99
|
1010
LL | let _: const_generic_lib::Alias = const_generic_lib::Struct([0u8, 1u8, 2u8]);
1111
| ^^^^^^^^^^^^^^^ expected an array with a fixed size of 2 elements, found one with 3 elements
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/const-argument-cross-crate-mismatch.rs:7:67
3+
|
4+
LL | let _ = const_generic_lib::function(const_generic_lib::Struct([0u8, 1u8]));
5+
| ^^^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements
6+
7+
error[E0308]: mismatched types
8+
--> $DIR/const-argument-cross-crate-mismatch.rs:9:65
9+
|
10+
LL | let _: const_generic_lib::Alias = const_generic_lib::Struct([0u8, 1u8, 2u8]);
11+
| ^^^^^^^^^^^^^^^ expected an array with a fixed size of 2 elements, found one with 3 elements
12+
13+
error: aborting due to 2 previous errors
14+
15+
For more information about this error, try `rustc --explain E0308`.

src/test/ui/const-generics/const-argument-cross-crate-mismatch.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// aux-build:const_generic_lib.rs
2+
// revisions: full min
23

34
extern crate const_generic_lib;
45

src/test/ui/const-generics/const-argument-cross-crate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// run-pass
2+
// revisions: full min
23
// aux-build:const_generic_lib.rs
34

45
extern crate const_generic_lib;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: type parameters must be declared prior to const parameters
2+
--> $DIR/complex-unord-param.rs:9:41
3+
|
4+
LL | struct NestedArrays<'a, const N: usize, A: 'a, const M: usize, T:'a =u32> {
5+
| ---------------------^----------------------^--------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, A: 'a, T: 'a, const N: usize, const M: usize>`
6+
7+
error: aborting due to previous error
8+

src/test/ui/const-generics/defaults/complex-unord-param.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
// run-pass
1+
// [full] run-pass
2+
// revisions: full min
23
// Checks a complicated usage of unordered params
3-
4-
#![feature(const_generics)]
5-
#![allow(incomplete_features)]
4+
#![cfg_attr(full, feature(const_generics))]
5+
#![cfg_attr(full, allow(incomplete_features))]
6+
#![cfg_attr(min, feature(min_const_generics))]
67
#![allow(dead_code)]
78

89
struct NestedArrays<'a, const N: usize, A: 'a, const M: usize, T:'a =u32> {
10+
//[min]~^ ERROR type parameters must be declared prior to const parameters
911
args: &'a [&'a [T; M]; N],
1012
specifier: A,
1113
}

src/test/ui/const-generics/defaults/intermixed-lifetime.stderr renamed to src/test/ui/const-generics/defaults/intermixed-lifetime.full.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: lifetime parameters must be declared prior to const parameters
2-
--> $DIR/intermixed-lifetime.rs:6:28
2+
--> $DIR/intermixed-lifetime.rs:7:28
33
|
44
LL | struct Foo<const N: usize, 'a, T = u32>(&'a (), T);
55
| -----------------^^---------- help: reorder the parameters: lifetimes, then consts and types: `<'a, const N: usize, T>`
66

77
error: lifetime parameters must be declared prior to type parameters
8-
--> $DIR/intermixed-lifetime.rs:9:37
8+
--> $DIR/intermixed-lifetime.rs:11:37
99
|
1010
LL | struct Bar<const N: usize, T = u32, 'a>(&'a (), T);
1111
| --------------------------^^- help: reorder the parameters: lifetimes, then consts and types: `<'a, const N: usize, T>`
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error: lifetime parameters must be declared prior to const parameters
2+
--> $DIR/intermixed-lifetime.rs:7:28
3+
|
4+
LL | struct Foo<const N: usize, 'a, T = u32>(&'a (), T);
5+
| -----------------^^---------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, const N: usize>`
6+
7+
error: type parameters must be declared prior to const parameters
8+
--> $DIR/intermixed-lifetime.rs:7:32
9+
|
10+
LL | struct Foo<const N: usize, 'a, T = u32>(&'a (), T);
11+
| ---------------------^------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, const N: usize>`
12+
13+
error: lifetime parameters must be declared prior to const parameters
14+
--> $DIR/intermixed-lifetime.rs:11:37
15+
|
16+
LL | struct Bar<const N: usize, T = u32, 'a>(&'a (), T);
17+
| --------------------------^^- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, const N: usize>`
18+
19+
error: type parameters must be declared prior to const parameters
20+
--> $DIR/intermixed-lifetime.rs:11:28
21+
|
22+
LL | struct Bar<const N: usize, T = u32, 'a>(&'a (), T);
23+
| -----------------^----------- help: reorder the parameters: lifetimes, then types, then consts: `<'a, T, const N: usize>`
24+
25+
error: aborting due to 4 previous errors
26+

0 commit comments

Comments
 (0)